Skip to content

Commit

Permalink
Ex-3
Browse files Browse the repository at this point in the history
  • Loading branch information
shubhamjuneja11 committed Oct 13, 2018
1 parent 839d6d9 commit 16d0688
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions exercises/js/sandbox.js
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)

0 comments on commit 16d0688

Please sign in to comment.