//Sample solution for script.js
$('document').ready(function() {
$('#changeButton').click(function() {
//use $('<div/>') to create two new divs
var $divToAppend = $('<div />');
var $divToPrepend = $('<div />');
//for the presentation and testing of your result
//(so you shouldn't change!)
$divToAppend.html('Append').addClass('appended');
$divToPrepend.html('Prepend').addClass('prepended');
var $divToInsertInside = $('#insertHere');
//append $divToAppend to $divToInsertInside
//using .appendTo
$divToAppend.appendTo($divToInsertInside);
//prepend $divToPrepend to $divToInsertInside
//using .prependTo
$divToPrepend.prependTo($divToInsertInside);
});
});
No comments:
Post a Comment