forked from rmurphey/jqfundamentals
-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
839d6d9
commit 16d0688
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
//Add five new list items to the end of the unordered list #myList. | ||
div=$('<div>') | ||
listItem=$('<li>').html('<span>List item<span>') | ||
for(var i=0; i<5; i++) { | ||
div.append(listItem.clone()); | ||
} | ||
$('#myList').append(div); | ||
|
||
|
||
//Remove the odd list items | ||
$('li:nth-child(odd)').remove() | ||
|
||
//Add another h2 and another paragraph to the last div.module | ||
var heading = $('<h2>').text('Hello'); | ||
var paragraph = $('<p>').text('Yes it is.'); | ||
var newDiv = $('<div>').append(heading,paragraph); | ||
$('div.module').last().append(newDiv); | ||
|
||
//Add another option to the select element; give the option the value "Wednesday" | ||
var option = $('<option>').text('Wednesday').attr('value','Wednesday'); | ||
$("select[name='day']").append(option); | ||
|
||
//Add a new div.module to the page after the last one; put a copy of one of the existing images inside of it. | ||
var newDiv = $('<div>').addClass('module').append($('img').get(0)); | ||
$("div.module").last().after(newDiv) |