jQuery ready Property

Beginner
5 min read
Updated: Oct 2026
4 examples
Live preview

What Is jQuery.ready?

jQuery.ready is a thenable (Promise-like object) that resolves when the document DOM is ready to manipulate (since jQuery 1.8). .ready() callbacks use this signal.

Remember
// Official pattern
$.when($.ready).then(function () {
  // Document is ready
});

// Combine with Ajax
$.when($.getJSON("ajax/test.json"), $.ready)
  .done(function (data) {
    // DOM ready + JSON loaded
  });

// Everyday callback form (related API)
$(function () { /* same ready moment */ });
NeedUse
Simple ready callback$(function () { … })
Ready + other async$.when($.ready, …)
Native Promise stylePromise.resolve($.ready)
Wait for images / assets$(window).on("load", …)

How to Use jQuery.ready

Pass the thenable to $.when or Promise.resolve, then run DOM code.

  1. Include jQuery before your script.
  2. Pass $.ready (same as jQuery.ready) to $.when() or Promise.resolve().
  3. In .then / .done, select elements and attach handlers.
  4. For everyday scripts, prefer $(fn); use $.ready when combining with Ajax or other promises.
PieceRequired?Role
jQuery.readyYesThenable that resolves at DOM ready
$.when / Promise.resolveYes (jQuery 3+)Supported ways to wait on it
HandlerYesCode that touches the DOM

Pseudocode

Pseudocode
signal = jQuery.ready   // thenable, not a callback

when signal resolves:
    DOM is safe to query and change

// Official idea:
$.when($.ready).then(runDomCode)

// With another async task:
$.when(fetchJson, $.ready).done(useBoth)

// Related everyday form:
$(runDomCode)   // same ready moment, callback style

Cheat Sheet

Keep these facts handy while waiting for the DOM.

TopicDetail
TypeThenable (Promise-like)
SincejQuery 1.8
jQuery 3.0+Use via $.when or Promise.resolve
Fires whenDOM ready (not full asset load)
Late scriptsStill resolves / runs handlers
Powers.ready() / $(fn)
Alias$.ready ≡ jQuery.ready

Live Preview

This page is already loaded, so $.ready resolves immediately — same idea as waiting in a real document.

Browser demo of jQuery.ready — same idea as the examples below.

Result
Ready — pick a pattern and run.

jQuery Examples

Short, copy-ready snippets. Open DevTools Console, or use Try It Yourself for a live editor.

Example 1 — Official: $.when($.ready)

Wait for the document ready thenable, then update the page.

jQuery
$.when($.ready).then(function () {
  // Document is ready.
  $("p").text("The DOM is now loaded and can be manipulated.");
});
Try It Yourself

How It Works

  1. Pass the thenable. $.ready is the ready signal.
  2. Wait with when. $.when resolves when that signal does.
  3. Then run. Your handler can safely select and change elements.
  4. Late scripts. If the DOM is already ready, it still runs.

Example 2 — Official Idea: Ready + Async Work

Wait until both a task and the DOM are ready before using the result.

jQuery
// Same idea as: $.when($.getJSON(url), $.ready)
var task = $.Deferred().resolve({ msg: "hello" }).promise();

$.when(task, $.ready).done(function (data) {
  // Document is ready.
  // Value from the async task is passed as `data`.
  $("#out").text(data.msg);
});
Try It Yourself

How It Works

  1. Two signals. One async result, plus $.ready.
  2. when waits for both. Neither alone is enough.
  3. done receives data. First argument is the resolved payload.
  4. DOM is safe. Writing to #out won’t race the parser.

Example 3 — Promise.resolve($.ready)

Use the native Promise API with the jQuery thenable (jQuery 3.0+).

jQuery
Promise.resolve($.ready).then(function () {
  document.getElementById("status").textContent = "DOM ready via Promise.resolve";
});
Try It Yourself

How It Works

  1. Wrap the thenable. Promise.resolve accepts any thenable.
  2. Chain .then. Native Promise style, same ready moment.
  3. Supported path. Official jQuery 3.0 guidance for this object.
  4. Still thenable. Do not assume $.ready itself is a Promise.

Example 4 — $.ready vs $(fn)

Same ready moment; pick callback style or thenable style.

jQuery
// Everyday callback (recommended for simple pages)
$(function () {
  console.log("ready via $(fn)");
});

// Thenable — best when combining with other async work
$.when($.ready).then(function () {
  console.log("ready via $.when($.ready)");
});
Try It Yourself

How It Works

  1. Same event. Both run when the DOM is ready.
  2. $(fn). Short and clear for most tutorials and apps.
  3. $.ready. Pass into $.when with Ajax or other promises.
  4. See also. Full callback API: .ready().

Edge Cases & Pitfalls

Check these before mixing ready with load or native listeners.

type

Not a Deferred you own

Do not .reject() or reinvent it. Use $.when / Promise.resolve.

load

Ready is not window load

Images may still be loading. Use load when you need full assets.

native

Late DOMContentLoaded can miss

A native listener added after the event fired never runs. jQuery ready still does.

simple

Prefer $(fn) for basic pages

Reach for $.ready when you need to combine ready with other async work.

Browser Support

jQuery.ready has been available since jQuery 1.8. jQuery 3.0+ documents usage via $.when or Promise.resolve. Needs a browser DOM with jQuery loaded.

✓ jQuery 1.8+ · Browsers only

jQuery.ready

Works in Chrome, Firefox, Safari, Edge, and other browsers with jQuery. Not for Node.js without a DOM.

100% Browser support
Google Chrome All versions · Desktop & Mobile
Full support
Mozilla Firefox All versions · Desktop & Mobile
Full support
Apple Safari All versions · macOS & iOS
Full support
Microsoft Edge All versions · Chromium & Legacy
Full support
Internet Explorer IE 6+ · Legacy environments
Full support
Opera All modern versions
Full support
jQuery.ready Browsers

Bottom line: Use $.when($.ready) or Promise.resolve($.ready) in the browser. For simple pages, $(fn) is enough.

Performance Notes

ApproachCostBest for
$(fn)Very lowMost page init code
$.when($.ready)Very lowReady + other promises
Promise.resolve($.ready)Very lowNative Promise chains

Ready handlers are cheap. Put only setup work here — avoid heavy work that blocks first paint. Defer non-critical fetches when you can.

Key Takeaways

  • Role: thenable that resolves when the DOM is ready.
  • Use with: $.when or Promise.resolve (jQuery 3+).
  • Everyday: prefer $(fn) for simple callbacks.
  • Not load: assets may still be loading after ready.

One line: $.when($.ready) is the promise-style twin of $(fn) — wait for the DOM, then act.

Frequently Asked Questions

jQuery.ready is a Promise-like object (thenable) on the jQuery namespace. It resolves when the document DOM is safe to manipulate — the same moment .ready() handlers run. Added in jQuery 1.8.
$(function(){ … }) is the common callback form (shorthand for .ready()). jQuery.ready is the underlying thenable you pass to $.when() or Promise.resolve(). Beginners usually use $(fn); jQuery.ready shines when combining ready with other async work.
Official pattern: $.when($.ready).then(function(){ /* DOM ready */ }); With Ajax: $.when($.getJSON(url), $.ready).done(function(data){ /* both finished */ }); Since jQuery 3.0 you can also use Promise.resolve($.ready).
As of jQuery 3.0, do not assume either. It is thenable — it has .then() and works with $.when and Promise.resolve(). Treat it as an opaque ready signal, not something to reject or extend.
jQuery.ready (and .ready()) fire when the HTML DOM is parsed — before images and other assets finish. The window load event waits for all assets. Use ready for DOM setup; use load when you need full resources (for example image sizes).
Yes. Handlers and $.when($.ready) still resolve even if your script runs late — unlike addEventListener('DOMContentLoaded') registered after the event already fired.

Next: .ready()

Learn the everyday callback form that uses this thenable under the hood.

.ready() tutorial →

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