jQuery: find

This entry is part 26 of 33 in the series jQuery Tutorial

find will get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element.

Given a jQuery object that represents a set of DOM elements, the find method allows us to search through the descendants of these elements in the DOM tree and construct a new jQuery object from the matching elements.

The find and children methods are similar, except that the latter only travels a single level down the DOM tree.

<!doctype html>
    <title>find demo</title>
    <script src='//code.jquery.com/jquery-1.10.2.js'></script>

<p><span>Hello</span>, how are you?</p>

<p>Me? I'm <span>good</span>.</p>

    $('p').find('span').css('color', 'red');



Series Navigation<< jQuery: children
jQuery: Other common traversing methods >>

Leave a comment

Leave a Reply