Wednesday, September 28, 2011

$(String,Element|jQuery)

$(String expr, Element|jQuery context) returns jQuery

This function accepts a string containing a CSS or basic XPath selector which is then used to match a set of elements.

Example:
Finds all p elements that are children of a div element.
$("div > p")

HTML:
<p>one</p> <div><p>two</p></div> <p>three</p>

Result:
<pre>[ <p>two</p> ]</pre>

No comments:

Post a Comment