Skip to the content.

$.fn.find(selector)

Find descendants of every item in the collection that match the selector. The selector is evaluated against each element’s subtree (not against the elements themselves), and the results are gathered into a single new collection.

Signatures

find(selector: Selector): this;

Parameters

Returns

A new Dabby collection containing every matched descendant of the original collection.

Examples

import $ from "dabbyjs";
import "dabbyjs/traversal/find/find";

// All external links inside any article
$("article").find("a.external");
import $ from "dabbyjs";
import "dabbyjs/traversal/find/find";

// Find a particular form field within a known wrapper
const $email = $(".signup-form").find("input[name=email]");
import $ from "dabbyjs";
import "dabbyjs/traversal/find/find";

// Find can take a Dabby collection or node, not just a string
const $rows = $("table");
const $cells = $rows.find($("td.value"));

See also