Friday, November 19, 2010

Descendant (E F)

Select all elements matched by F that are descendants of an element matched by E.
Examples
1- $('#container p') selects all paragraph elements that are descendants of an element that has an ID of container
2- $('a img') selects all <img> elements that are descendants of an <a> element

Descendants of an element are that element's children, grandchildren, great-grandchildren, and so on.

For example, in the following HTML code, the <img> element is a descendant of the <span>, <p>, <div id="inner">, and <div id="container"> elements:
<div id="container">
<div id="inner">
<p>
<span><img src="example.jpg" alt="" /></span>
</p>
</div>
</div>

No comments:

Post a Comment