jQuery.ready

A Promise-like object (or "thenable") that resolves when the document is ready.

jQuery.ready()🡢 Thenable

As of jQuery 3.0, use of this object is supported via jQuery.when or the native Promise.resolve(). Code should not make assumptions about whether this object is a jQuery.Deferred, native Promise, or some other type of promise object.

See also ready(), which makes use of this.

Listen for document ready using jQuery.when.

HTML
$.when($.ready).then(function () {
  // Document is ready.
});
DEMO

Typical usage involving another promise, using jQuery.when.

HTML
$.when($.getJSON("ajax/test.json"), $.ready).done(function (data) {
  // Document is ready.
  // Value of test.json is passed as `data`.
});
DEMO

Looking for a Web Developer?

👋

Hi! I'm Basti, author of this site. If you are looking for a web developer with 15+ years of experience, holla at me!

Be it the good 'ol jQuery, vanilla JS or modern frameworks like Vue and Svelte, front- or backend, I can help you.

Just write me at jobs@jqapi.com :)