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.
Syntax
Start with these common calls. Keep them short and readable.
jQuery
callbacks.add(fn)
callbacks.fire("foo") // runs
callbacks.disable()
callbacks.fire("foobar") // ignored — no output
disabled() → true after disable()
no enable() method exists
Call
What it does
Callbacks object
List to shut down
Arguments
disable() takes no parameters
Return
Same Callbacks object (chainable)
Load jQuery before your script (CDN or local file), then wrap DOM work in $(function () { ... }) when needed.
Parameters
Parameter
Description
Step 1
Create and use a Callbacks list normally (add / fire).
Step 2
When the feature ends (destroy, unmount, fatal error), call disable().
Step 3
Optionally check disabled() in shared helpers before firing.
Return Value
Return Value
Description
Boolean
Often true or false depending on the match or state.
jQuery Examples
Example 1 — Disable Before fire()
Register handlers, call disable(), then try to fire — nothing runs.
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.