jQuery .find() Method

Beginner
5 min read
Updated: Nov 2026
3 examples
Traversing

Definition

.find() gets the descendants of each element in the current set, filtered by a selector, jQuery object, or DOM element. It searches the whole subtree — not just one level. Selector form since jQuery 1.0; element/jQuery argument since 1.6.

Syntax

Call .find() on a jQuery set. Start with these lines.

jQuery
$("li.item-ii").find("li");
$("p").find("span");
$("#box").find("*");
CallWhat it does
$("root").find("sel")Searches all descendants of each matched root for sel.
$("root").find("*")Gets every element descendant at any depth.
$("root").find($set)Keeps members of $set that are descendants of the root (1.6+).

.find() goes any depth. Use .children() for one level only. Official shorthand: $("li.item-ii").find("li") equals $("li", "li.item-ii").

Parameters

ParameterDescription
selectorRequired in the common form. A CSS selector for matching descendants. Use "*" for every element descendant.
element / jQueryOptional alternate form (1.6+). Pass a DOM element or jQuery set; only descendants of the current roots are kept.

Return Value

Return ValueDescription
jQuery objectA new collection of matching descendants. The starting element is never included. Empty if nothing matches.

jQuery Examples

Example 1 — Official Nested List: .find("li")

Find every nested list item under item II (jQuery API example).

jQuery
var $hits = $("li.item-ii").find("li");
console.log($hits.length);
console.log($hits.map(function () {
  return this.firstChild.textContent.trim();
}).get().join(", "));
Try It Yourself

How It Works

  1. Start at II. $("li.item-ii") is the root.
  2. Search descendants. .find("li") walks the whole subtree.
  3. Skip the root. II matches li but is not a descendant of itself.

Example 2 — Official: $("p").find("span")

Same idea as the descendant selector $("p span").

jQuery
var $a = $("p").find("span");
var $b = $("p span");

console.log("find →", $a.map(function () {
  return this.textContent.trim();
}).get().join(", "));
console.log("same size:", $a.length === $b.length);
Try It Yourself

How It Works

  1. Start with paragraphs. $("p") is the root set.
  2. Find nested spans. Only spans inside those p tags match.
  3. Same as p span. Official docs call this out.

Example 3 — .find() vs .children()

Any depth vs one level — nested spans under a box.

jQuery
var $box = $("#box");
console.log("find:", $box.find("span").map(function () {
  return this.textContent.trim();
}).get().join(", "));
console.log("children:", $box.children("span").map(function () {
  return this.textContent.trim();
}).get().join(", "));
Try It Yourself

How It Works

  1. .find("span"). Matches the direct span and the nested one.
  2. .children("span"). Only the span that is a direct child of #box.
  3. Depth is the difference. Official docs: .children() travels one level only.

Frequently Asked Questions

.find() searches through all descendants of each element in the current jQuery set and returns a new jQuery object of matching nodes. Available since 1.0 (selector); element/jQuery argument since 1.6.
.children() travels only one level down (direct children). .find() searches every depth — grandchildren and deeper. Official docs: they are similar except for how far down they go.
.find() drills into descendants and can return nodes that were not in the original set. .filter() only narrows the current set — it never adds deeper nodes.
Yes. Unlike many traversing methods, .find() requires an argument. Pass "*" to get every descendant element at any depth.
No. Only descendants are candidates. $("li.item-ii").find("li") does not include item II itself — only nested li elements inside it.
Yes for the common case. Official docs: $("li.item-ii").find("li") is equivalent to $("li", "li.item-ii").

Next: .next() Method — Immediate Next Sibling

Reduce a matched set to its first element.

.next() Method — Immediate Next Sibling tutorial →

CODETOFUN NEWS

Stay Ahead in Tech

Get the latest IT news, programming updates, and technology trends directly on your phone.

Your daily dose of tech, straight to your feed.

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

11 people found this page helpful