jQuery .find() Static Method

Beginner
5 min read
Updated: Nov 2026
3 examples
Utilities

Definition

jQuery.find( selector [, context ] ) (alias $.find) is the selector engine jQuery uses internally (Sizzle in jQuery 1.3–3.x). It returns a plain array of DOM elements, not a jQuery object. This is the static helper on $, not the .find() traversal method.

Syntax

Start with these common calls. Keep them short and readable.

jQuery
$.find(selector)                      → Array of DOM elements
$.find(selector, context)             → search inside context only

$.find("li.item")                     // from the document
$.find("span", document.getElementById("box"))

// Advanced (Sizzle signature):
$.find(selector, context, results, seed)
CallWhat it does
$.find(selector)Search the whole document and return an array of matches.
$.find(selector, context)Search only inside a DOM element or document.
$.find(sel, ctx, results)Push matches onto an existing array and return that array.
$.find.matchesSelector(el, expr)Return true when one element matches a selector.

jQuery.find is an internal, officially undocumented API and may change between major versions. In app code prefer $(selector, context) or $context.find(selector).

Parameters

ParameterDescription
selectorString — a CSS or jQuery selector, including jQuery extensions such as :first or :contains().
context (optional)Element or Document — where to search. Defaults to document. Must be a native DOM node, not a jQuery object.
results (advanced, optional)Array — an existing array to push the matches onto. That same array is returned.
seed (advanced, optional)Array — a list of elements to filter by the selector instead of searching the DOM.

Return Value

Return ValueDescription
ArrayA plain array of matched DOM elements in document order. It is empty when nothing matches. If you pass results, that array is returned.
Not a jQuery objectNo .css() or .addClass() on the result. Wrap it with $( $.find(sel) ) when you need jQuery methods.

jQuery Examples

Example 1 — Search the Whole Document

Call $.find() with only a selector and inspect the plain array it returns.

jQuery
var items = $.find("li.item");

console.log(Array.isArray(items));  // true
console.log(items.length);          // 3
console.log(items[0].textContent);  // "One"
Try It Yourself

How It Works

  1. Select. $.find("li.item") runs the selector engine on the document.
  2. Array. The result is a real array, so Array.isArray() is true.
  3. Read. Each entry is a raw DOM element — use textContent, not .text().

Example 2 — Limit the Search with a Context

Pass a DOM element as the second argument to search only inside it.

jQuery
var box = document.getElementById("a");

var inA = $.find("span", box);
var all = $.find("span");

console.log(inA.length);  // 2
console.log(all.length);  // 4
Try It Yourself

How It Works

  1. Context. box is a native element — #a contains two spans.
  2. Scoped. $.find("span", box) ignores spans outside #a.
  3. Global. Without a context the search covers all four spans on the page.

Example 3 — Compare with $() and .find()

All three find the same elements — only the return type differs.

jQuery
var viaStatic = $.find(".item");
var viaDollar = $(".item");
var viaFind   = $("#list").find(".item");

console.log(viaStatic.length, viaDollar.length, viaFind.length);  // 3 3 3
console.log(viaStatic[0] === viaDollar[0]);   // true
console.log(viaDollar instanceof jQuery);     // true
console.log(viaStatic instanceof jQuery);     // false
Try It Yourself

How It Works

  1. Same elements. The engine behind $(selector) is $.find.
  2. Wrapper. $(...) and .find() wrap the matches in a jQuery object.
  3. Raw array. $.find() skips the wrapper, so it is not a jQuery instance.

Frequently Asked Questions

jQuery.find(selector, context) is the entry point to jQuery's selector engine (Sizzle in jQuery 3.x). It runs a CSS or jQuery selector and returns a plain array of matching DOM elements. $(selector) and the .find() method use it internally.
$.find() is a static utility on the jQuery function: it takes a selector and optional DOM context and returns an array. .find() is an instance method on a jQuery collection: $("#list").find(".item") searches descendants and returns a new jQuery object you can chain.
It is not documented in the official jQuery API and is treated as internal. It has worked for years, but the engine behind it can change between major versions, so avoid it in application code.
A plain JavaScript array of DOM elements in document order, or an empty array when nothing matches. If you pass a results array as the third argument, matches are pushed onto it and that same array is returned.
No. The context must be a native DOM element or document. Unwrap a jQuery object first with [0] or .get(0), or simply use $(selector, context) which accepts both.
Use $(selector) for the whole page, $(selector, context) or $context.find(selector) for a scope, and $.contains() or .is() for checks. Use document.querySelectorAll() when you do not need jQuery-only selectors like :first.

Next: jQuery.data() Method

Store and read custom data on DOM elements with jQuery.

jQuery.data() Method 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.

8 people found this page helpful