callbacks.empty() removes all callbacks from a list (since jQuery 1.7). The official API: remove all of the callbacks from a list. The list stays reusable — you can add() again. Returns the same Callbacks object for chaining.
Syntax
Start with these common calls. Keep them short and readable.
jQuery
callbacks.add(foo)
callbacks.add(bar)
callbacks.empty()
callbacks.has(foo) → false
callbacks.has(bar) → false
callbacks.add(newFn) // still allowed
callbacks.fire() // runs newFn only
Call
What it does
Callbacks object
List to clear
Arguments
empty() 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
Register handlers with add() as usual.
Step 2
Call empty() to wipe every handler in one step.
Step 3
Optionally verify with has(fn) → false.
Return Value
Return Value
Description
jQuery object
Most setters and traversing helpers return the jQuery collection so you can chain more methods.
jQuery Examples
Example 1 — Clear All Callbacks
Add two handlers, call empty(), then fire() — silent.
empty() removes every handler from the Callbacks list in one call. After empty(), fire() runs nothing until you add() new functions. The list itself stays active — unlike disable(), which permanently shuts down firing.
remove(fn) drops specific function references you pass in. empty() wipes the entire list at once — useful when you want a clean slate without tracking each handler.
empty() clears handlers but the list can still accept add() and fire() afterward. disable() permanently prevents all future firing; disabled() stays true.
Yes. It returns the same Callbacks object, so you can chain: callbacks.empty().add(fn).fire().
Use has(fn) for a known reference — after empty(), has(foo) returns false for every previously registered function. That matches the official API example.
On a locked list, empty() is ignored (membership is frozen). On a disabled list, clearing handlers does not re-enable firing — disabled() stays true. Prefer empty() on active lists you plan to reuse.