Finding Descendant Elements

$("table").find("span")   //selects all <span> elements contained   //somewhere in <table> elements $("#myForm").find("input")   //selects all <input> elements contained   //somewhere in element #myForm

The .find(filter) method returns a jQuery object representing descendants of the current set that match the filter supplied. The filter can be a selector, a jQuery object to match elements against, or an element tag name.

Example: Selects all <span> elements contained somewhere in <table> elements.

Get jQuery and JavaScript Phrasebook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.