callbacks.disable() permanently shuts down a Callbacks list (since jQuery 1.7). The official API describes it as disabling the list from doing anything more. Afterward, fire() / fireWith() are no-ops. Returns the same Callbacks object for chaining.
Remember
callbacks.add(fn)
callbacks.fire("foo") // runs
callbacks.disable()
callbacks.fire("foobar") // ignored — no output
disabled() → true after disable()
no enable() method exists
Call it when the list must never run again — usually during teardown.
Create and use a Callbacks list normally (add / fire).
When the feature ends (destroy, unmount, fatal error), call disable().
Optionally check disabled() in shared helpers before firing.
Remember: no re-enable — make a new list if you need a fresh bus.
Piece
Required?
Role
Callbacks object
Yes
List to shut down
Arguments
None
disable() takes no parameters
Return
—
Same Callbacks object (chainable)
Pseudocode
Pseudocode
list = Callbacks queue
disabledFlag = false
disable():
disabledFlag = true
// list can no longer do anything useful
fire(args…):
if disabledFlag:
return // no-op
call every handler
disabled():
return disabledFlag
Reference
Cheat Sheet
Keep these facts handy when tearing down Callbacks lists.
Topic
Detail
Syntax
callbacks.disable()
Arguments
None
Effect
Future fire() / fireWith() ignored
Reversible?
No — permanent
Status check
disabled() → true
vs lock()
Lock freezes membership; fire still works
Since
jQuery 1.7
Try it
Live Preview
Compare disable timing and lock() side by side on a fresh list.
Browser demo of callbacks.disable — same ideas as the examples below.
Result
add(foo); disable(); fire("x")
→ (no output)
disabled() → true
Code
jQuery Examples
Short, copy-ready snippets. Open DevTools Console, or use Try It Yourself for a live editor.
Example 1 — Disable Before fire()
Register handlers, call disable(), then try to fire — nothing runs.
Cleanup: destroying
Widget torn down, hooks disabled
How It Works
Expose a hooks list. Consumers subscribe via onDestroy.add.
Final fire. Cleanup handlers run with "destroying".
Disable. The bus cannot fire again after teardown.
Stray fire. Later fire() calls are silently ignored.
Edge Cases & Pitfalls
Check these before using disable() as teardown.
permanent
No enable()
You cannot undo disable(). Create a new $.Callbacks() list if you need a fresh bus.
silent
Fire becomes a silent no-op
No error is thrown. Use disabled() when you need an explicit log or early return.
lock
Do not confuse with lock()
lock() still allows fire(). Pick the wrong one and handlers keep running after “teardown.”
empty
empty() ≠ disable
empty() clears handlers but the list can still accept new add() / fire() calls.
once
once is not the same
$.Callbacks("once") stops after one fire but is a creation flag. disable() shuts down any list at any time.
Compatibility
Browser Support
callbacks.disable() is part of jQuery’s Callbacks API (since 1.7). It works in any browser where your jQuery build runs — the list logic lives in jQuery, not as a separate browser API.
✓ jQuery 1.7+ · Browsers
jQuery callbacks.disable()
Supported in jQuery 1.x, 2.x, and 3.x across Chrome, Firefox, Safari, Edge, and other browsers with jQuery loaded.
100%With jQuery loaded
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
callbacks.disable()Browsers
Bottom line: Safe wherever jQuery is loaded. Call disable() for final teardown; use disabled() to read status.
Analysis
Performance Notes
Operation
Cost
Best for
disable()
O(1)
One-time teardown
disabled()
O(1)
Status checks in helpers
fire() when disabled
O(1) early exit
Safe stray calls (still prefer a guard for clarity)
disable() is cheap. Call it once at teardown — do not toggle repeatedly (you cannot re-enable anyway). Prefer one disable on destroy over repeatedly checking custom flags in every hot path.
Remember
Key Takeaways
Role: permanently stop a Callbacks list from doing more work.
vs lock: lock freezes membership; disable kills firing.
Teardown: fire a final event, then disable() so late calls cannot revive the bus.
One line:disable() is the permanent off switch for a Callbacks list.
Frequently Asked Questions
disable() permanently shuts down a Callbacks list. After calling it, fire() and fireWith() become no-ops — they return without invoking handlers. The official description is: disable a callback list from doing anything more.
No. jQuery has no enable() method. disable() is one-way. To fire again, create a fresh $.Callbacks() list or keep your own pause flag outside Callbacks.
lock() freezes the handler set — no more add() or remove() — but fire() still runs existing handlers. disable() stops all future firing. lock() protects the queue; disable() kills it.
Treat disable() as final teardown. Further add() and fire() calls are effectively ignored. Check disabled() when debugging missing handlers.
Call disabled() — it returns true after disable() has run. That is the read-only status check; disable() is the action that turns firing off.
Common cases: plugin destroy/unmount, shutting down an event bus after app teardown, or blocking stray fires after a one-time workflow completes. Pair with disabled() in defensive helpers.