Writing a Plugin (^) ❘ 249
It might seem redundant, but next I include the same CSS that you saw in Example 9-1 so that you
can see all the components of this document, leaving nothing to mystery.
body {
font: 200 16px Helvetica, Arial, sans-serif;
}
h2 {
font: 200 18px Helvetica, Arial, sans-serif;
text-decoration: underline;
}
ul.movieList {
list-style: none;
margin: 10px;
padding: 0 ;
}
ul.movieList li {
padding: 3px;
}
ul.movieList li.movieSelected {
background: forestgreen;
color: white;
}
a {
text-decoration: none;
color: green;
}
a:hover {
text-decoration: underline;
}
Finally, we get to the JavaScript document, Example 9-2.js:
document.addEventListener(
'DOMContentLoaded',
function()
{
var a = document.getElementById('movieSelectAll');
for (var property in a)
{
console.log(property);
}
}
);
In Example 9-2, you cast aside jQuery for a moment for the traditional JavaScript Document Object
Model. You grab an element from the document and then put it inside a for/in loop to examine
what methods and properties are attached to the element.
You can take a look at the structure of jQuery itself by putting something like this (Example 9-3) in
a JavaScript fi le:
$.fn.extend({
select : function()
http://www.it-ebooks.info
elliott
(Elliott)
#1