English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
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.
$$(selector).find(selectorExpression)
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":
p (grandchild) span (great-grandchild)
Parameter | Description |
---|---|
selectorExpression | Selector expression, element, or jQuery object to match the element with Note:To search multiple descendants, separate each expression with a comma |