jQuery ready Property

Beginner
5 min read
Updated: Nov 2026
3 examples
DOM

Definition

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.

Syntax

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

jQuery
// 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 */ });
CallWhat it does
readyLearn jQuery.ready: Promise-like thenable that resolves when the DOM is ready, $.when patterns, vs .ready(), examples, pitfalls, and FAQs.

Load jQuery before your script (CDN or local file), then wrap DOM work in $(function () { ... }) when needed.

Parameters

ParameterDescription
Step 1Include jQuery before your script.
Step 2Pass $.ready (same as jQuery.ready) to $.when() or Promise.resolve().
Step 3In .then / .done, select elements and attach handlers.

Return Value

Return ValueDescription
See examplesCheck the examples below for what this API returns in common cases.

jQuery Examples

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.

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.

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.

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: .appendTo() Method

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

.appendTo() 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