Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ex3 #3

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ The content is now being maintained by the jQuery Project at [web-learn-jquery-c

jQuery Fundamentals will be serving as the basis for a new jQuery learning site
maintained by the jQuery project, and ongoing maintenance and support for this
content will transfer to the jQuery project. For more details, se my [blog
content will transfer to the jQuery project. For more details, see my [blog
post](http://blog.rebeccamurphey.com/the-future-of-jquery-fundamentals-and-a-confe).

Please do not open issues on this repo; use the new jQuery Project repo instead.
Expand Down
24 changes: 24 additions & 0 deletions exercises/js/sandbox.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//Add five new list items to the end of the unordered list #myList.
var 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'),
paragraph = $('<p>').text('Yes it is.'),
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);