pav
9/15/2013 - 7:24 PM

print_all_properties_jquery_object

<html>

<head>

<title>Exercise 1.1</title>

<script src="script.js"></script>

<style type="text/css">
div#left {
    float:left;
    width:50%;
}
div#right{
    float:right;
    width:50%;
}
</style>

</head>

<body>

<div id="left">
<h1>$ methods and attributes</h1>
<ul id='jQueryAttributes'>
</ul>
</div>

<div id="right">
<h1>$() methods and attributes</h1>
<ul id='jQueryObjectAttributes'>
</ul>
</div>

</body>

</html>
$('document').ready(function() {

//utility method -- by the end of this lesson
//you'll know enought to write it yourself!
function addListItemTo(listId,item) {
    $('#'+listId).append($('<li/>').html(item));
}


var jQuery = $;
var jQueryObject = $();

//iterate over jQuery, adding every key to the list with id 
//jQueryAttributes using addListItemTo() 
//you just need to write the for loop
for(var key in jQuery){
    addListItemTo("jQueryAttributes",key);
}    

//iterate over jQueryObject, adding every key to the list with id 
//jQueryObjectAttributes using addListItemTo()
//you just need to write the for loop again\
for(var key2 in jQueryObject){
    addListItemTo('jQueryObjectAttributes',key2);
}


});