02.06.2013 Views

DOM Traversal Methods

DOM Traversal Methods

DOM Traversal Methods

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Miscellaneous <strong>Methods</strong><br />

Description<br />

Suppose we had a simple unordered list on the page:<br />

<br />

foo<br />

bar<br />

<br />

We can determine the number of list items by calling .length:<br />

$().log('Length: ' + $('li’).length);<br />

.size()<br />

Returns the number of <strong>DOM</strong> elements matched by the jQuery object.<br />

Parameters<br />

None.<br />

.size()<br />

Return Value<br />

The number of elements matched.<br />

Description<br />

Suppose we had a simple unordered list on the page:<br />

<br />

foo<br />

bar<br />

<br />

We can determine the number of list items by calling .size():<br />

$().log('Size: ' + $('li’).size());<br />

.get()<br />

Retrieves <strong>DOM</strong> elements matched by the jQuery object.<br />

.get([index])<br />

[ 172 ]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!