Quotes help make search much faster. Example: "Practice Makes Perfect"

Monday, November 5, 2012

Codecademy: Sample Solution to "The jQuery Objects"



//ignore this for now
$('document').ready(function(){

//$exampleJQuery is jQuery object containing every element
// in the HTML page
var $exampleJQuery = $('*')

//utility function provided for you (uses jQuery!);
function addToKeyList(key) {
    $('#keylist').append('<li>'+key+'</li>');
}

//iterate over $exampleJQuery
//calling addToKeyList for every key it contains
for(var i=0; i<$exampleJQuery.length; i++)
{
addToKeyList($exampleJQuery[i]);
}

//run this code and check out the list.
//a lot of cool things, there,
//that you will be learning about in the next couple of weeks
});

No comments:

Post a Comment


This is an example of scrolling text using Javascript.

Popular Posts