Wednesday, September 28, 2011

get(Number)

get(Number num) returns Element
Access a single matched DOM element at a specified index in the matched set. This allows you to extract the actual DOM element and operate on it directly without necessarily using jQuery functionality on it.
Example:
Selects all images in the document and returns the first one
$("img").get(0);

HTML:
<img src="test1.jpg"/> <img src="test2.jpg"/>

Result:
<img src="test1.jpg"/>

No comments:

Post a Comment