jQuery.holdReady(hold) (since 1.6) delays or releases jQuery’s document ready event. Pass true to hold, false to release one hold. It is deprecated since 3.2 but still works in jQuery 3.x.
Remember
// Deprecated (since 3.2) — call early, before ready fires
$.holdReady(true); // delay ready
$.holdReady(false); // release one hold
// Modern replacement
$.when($.ready, customPromise)
.then(function () {
// main code
})
.catch(function (error) {
// handle errors
});
Call early, pair every hold with a release, and prefer $.when for new work.
Call $.holdReady(true) in the <head> right after the jQuery script tag.
Load plugins or other async work (for example with $.getScript).
Call $.holdReady(false) when that work finishes — one release per hold.
Register ready handlers with $(function () { … }) as usual; they wait while held.
In new code, replace the global switch with $.when($.ready, promise).
Piece
Required?
Role
hold
Yes
true = delay · false = release one
Timing
Critical
Must run before ready already fired
Counter
Implicit
Each true needs a matching false
Return
—
undefined
Pseudocode
Pseudocode
call $.holdReady(true) early
→ holdCount = holdCount + 1
→ ready handlers wait
load plugin / async work
call $.holdReady(false)
→ holdCount = holdCount - 1
when holdCount === 0 and DOM is ready:
fire jQuery ready
run all $(function () { ... }) handlers
if holdReady(true) after ready already fired:
no effect
modern path:
$.when($.ready, customPromise).then(main)
Reference
Cheat Sheet
Quick facts for reading or migrating legacy holdReady code.
Topic
Detail
Hold
$.holdReady(true) ⚠
Release
$.holdReady(false)
Modern
$.when($.ready, promise).then(fn)
Since
1.6 · deprecated 3.2
Returns
undefined
When to call
Immediately after loading jQuery
Too late?
No effect if ready already fired
Multiple holds
Need matching number of releases
Try it
Live Preview
This page’s ready event already fired, so the demo simulates hold/release timing and the modern $.when pattern.
Simulation only — use Try It Yourself for a real early holdReady(true) in <head>.
Result
Ready — pick an action and click Run.
Code
jQuery Examples
Short demos of the legacy API and the modern replacement. Prefer $.when for new projects.
Example 1 — Hold Until a Plugin Loads
Official pattern: hold, load a script, then release.
Hold. Ready is blocked even if the DOM is already parsed.
Register.$(function () { … }) queues the handler.
Wait. The timer stands in for async work.
Release.false lets the queued handler run.
Example 3 — Multiple Holds
Two true calls need two false calls before ready runs.
jQuery
$.holdReady(true);
$.holdReady(true);
$(function () {
$("#out").text("Ready finally runs");
});
$.holdReady(false); // still held
$.holdReady(false); // now ready can fire
Ready already ran. holdReady(true) after ready — no effect. Inner handler still runs immediately.
How It Works
Ready first. The outer handler means ready already fired.
Late hold.holdReady(true) cannot rewind ready.
Immediate. New ready callbacks run right away.
Lesson. Always hold in <head> before ready.
Edge Cases & Pitfalls
Watch for these when reading or migrating holdReady code.
deprecated
Do not use in new code
Deprecated since 3.2. Prefer $.when($.ready, promise).
timing
Must call before ready
A late holdReady(true) has no effect. Put it in <head> after jQuery.
balance
Unbalanced holds hang ready
Every true needs a false. A missing release means ready never fires.
errors
Failed loads must still release
If getScript fails, still call holdReady(false) (or reject a promise) so the page does not wait forever.
Compatibility
Browser Support
jQuery.holdReady() has been part of jQuery since 1.6. It is deprecated since 3.2 but still functional in jQuery 3.x. Prefer $.when($.ready, …) for new projects.
✓ Deprecated · jQuery 1.6+
jQuery.holdReady()
Works wherever your loaded jQuery version runs. Treat it as a legacy global switch — migrate to explicit promises when updating code.
100%With jQuery 3.x
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
holdReadyLegacy API
Bottom line: Safe in legacy loaders. For new apps, wait with $.when($.ready, customPromise) instead of holding the global ready event.
Analysis
Performance Notes
Approach
Cost
Best for
Short hold + small plugin
Cheap
Legacy loaders
$.when($.ready, promise)
Cheap
Modern compose of ready + async
Long / forgotten hold
Expensive (UX)
Avoid — page init never starts
Holding ready does not slow the network by itself — it delays your init code. Keep holds short and always release them.
Remember
Key Takeaways
Role: delay jQuery ready until plugins or scripts finish loading.
Migrate:$.when($.ready, promise).then(fn) — preferred since 3.2.
Timing: call holdReady(true) early — too late does nothing.
Balance: every true needs a matching false.
One line:holdReady is a deprecated global pause for ready — use $.when($.ready, …) instead.
Frequently Asked Questions
jQuery.holdReady(hold) pauses or releases jQuery's document ready event. Pass true to delay ready handlers; pass false to release one hold. Added in jQuery 1.6 for dynamic script loaders that need plugins loaded before page init.
Yes. It was deprecated in jQuery 3.2. Prefer $.when($.ready, customPromise).then(...). It still works in jQuery 3.x but should not appear in new code.
Early in the document — typically in the head immediately after the jQuery script tag, before DOM ready fires. Calling holdReady(true) after ready already ran has no effect.
Yes. Each holdReady(true) increments an internal counter. Ready does not fire until every hold is released with a matching holdReady(false) and normal DOM ready conditions are met.
Use $.when($.ready, yourPromise).then(function(){ /* main code */ }).catch(function(err){ /* errors */ }). Build a Deferred or Promise for getScript, dynamic imports, or module loading, then compose it with $.ready.
$.ready is the thenable that resolves when ready fires. holdReady blocks that resolution until holds are released. While held, $(function(){}) callbacks wait even if the HTML DOM is already parsed.