English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

jQuery find() Method

jQuery Traversal Methods

The find() method returns elements that match the specifiedselectorExpressionall descendant elements that match.

The find() method traverses the descendants of the DOM element downwards, all the way to the last descendant. If you want to traverse only a single level under the DOM tree (to return direct children), please usechildren()Method.

Syntax:

$$(selector).find(selectorExpression)

Example

Starting from all paragraphs and searching for descendant span elements, it is the same as $("p span"):

$ (document).ready(function(){
  $("p").find("span").css("background", "mediumpurple");
});
Test and see‹/›

Return multiple descendant elements:

$ (document).ready(function(){
  $("p").find("span, i").css("background", "mediumpurple");
});
Test and see‹/›

Return all DIV elements that are children of div id="box":

body (grandparent)
div id="box" (parent)
div (direct child)
div (grandchild)

p (grandchild) span (great-grandchild)

Run Code

Parameter Value

ParameterDescription
selectorExpressionSelector expression, element, or jQuery object to match the element with
Note:To search multiple descendants, separate each expression with a comma

jQuery Traversal Methods