Front-end Web Development
Assignment for Week 9
- Download this zip with an HTML and CSS file.
- Include a
<script>
reference in the HTML file to the latest version of jQuery.
- Create a JS file of your own and include a
<script>
reference to it in the HTML file.
-
Add behavior that makes clicking the "Add a new item"
button
create a new item at the end of the to-do-list
, based off the first existing item. You will want to use these jQuery functions:
$
.on
(with the 'click'
event)
.first
.clone
.append
Read up on the jQuery API Documentation to learn how to use these functions. A great help would be to use this version of the Twitter client we looked at in class, which uses the above functions.
Extra credit:
- Change the CSS so
new-field
is shown by default.
- Change the JS such that the text in the new item is the same as what's in
new-field
. You will need these additional jQuery functions:
Solution