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 */ });
Pass the thenable to $.when or Promise.resolve, then run DOM code.
Include jQuery before your script.
Pass $.ready (same as jQuery.ready) to $.when() or Promise.resolve().
In .then / .done, select elements and attach handlers.
For everyday scripts, prefer $(fn); use $.ready when combining with Ajax or other promises.
Piece
Required?
Role
jQuery.ready
Yes
Thenable that resolves at DOM ready
$.when / Promise.resolve
Yes (jQuery 3+)
Supported ways to wait on it
Handler
Yes
Code 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
Wait with when.$.when resolves when that signal does.
Then run. Your handler can safely select and change elements.
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);
});
Wrap the thenable.Promise.resolve accepts any thenable.
Chain .then. Native Promise style, same ready moment.
Supported path. Official jQuery 3.0 guidance for this object.
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)");
});
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.
Compatibility
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 ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions · Chromium & Legacy
Full support
Internet ExplorerIE 6+ · Legacy environments
Full support
OperaAll modern versions
Full support
jQuery.readyBrowsers
Bottom line: Use $.when($.ready) or Promise.resolve($.ready) in the browser. For simple pages, $(fn) is enough.
Analysis
Performance Notes
Approach
Cost
Best for
$(fn)
Very low
Most page init code
$.when($.ready)
Very low
Ready + other promises
Promise.resolve($.ready)
Very low
Native 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.
Remember
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.