jQuery Callbacks Methods

About This Index
This page is the jQuery Callbacks index for the tutorial track. Each row links to a full guide with syntax, examples, and FAQs.
Learn the jQuery overview on /jquery. Use this page when you need a Callbacks API such as $.Callbacks(), callbacks.add(), or callbacks.fire().
Start with $.Callbacks(), then add() and fire()—learn fireWith(), lock(), and disable() when you need context or lifecycle control.
How to Call a Callbacks Method
Create a list, register handlers, then fire them—optionally with flags like once and memory:
var list = $.Callbacks("unique");
function greet(name) {
console.log("Hello, " + name);
}
list.add(greet);
list.fire("Ada"); // Hello, Ada
list.has(greet); // true
list.remove(greet);
list.empty();
var once = $.Callbacks("once memory");
once.add(function (msg) { console.log(msg); });
once.fire("ready");
once.add(function (msg) { console.log("late:", msg); }); // replays "ready" jQuery Callbacks Methods Table
All Callbacks method guides in this jQuery tutorial series (12 tutorials).
Getting Started
3 methodsCreate a Callbacks list, register handlers, and fire them.
| Method | Description | Tutorial |
|---|---|---|
$.Callbacks() | Create a managed callback list — optional once, memory, unique, and stopOnFalse flags. | Try it |
callbacks.add() | Register one or more handler functions on the list. | Try it |
callbacks.fire() | Invoke all handlers with optional arguments. | Try it |
List Management
3 methodsUnregister handlers, clear the list, and check membership.
| Method | Description | Tutorial |
|---|---|---|
callbacks.remove() | Unregister specific handler references from the list. | Try it |
callbacks.empty() | Remove every handler from the list in one call. | Try it |
callbacks.has() | Check whether a function is registered, or whether the list has any handlers. | Try it |
Invoke & Status
2 methodsFire with a custom this context and check whether the list has fired.
| Method | Description | Tutorial |
|---|---|---|
callbacks.fireWith() | Invoke handlers with a custom this context and an arguments array. | Try it |
callbacks.fired() | Return true if the list has been fired at least once. | Try it |
Control
4 methodsLock the handler set, disable firing, and read status flags.
| Method | Description | Tutorial |
|---|---|---|
callbacks.disable() | Permanently shut down the list — fire() becomes a no-op. | Try it |
callbacks.disabled() | Return true if disable() was called on the list. | Try it |
callbacks.lock() | Freeze the list — add(), remove(), and empty() stop working. | Try it |
callbacks.locked() | Return true if lock() was called on the list. | Try it |
Frequently Asked Questions
Start with $.Callbacks()
Open the factory guide—syntax, flags, examples, and FAQs.
CODETOFUN NEWS
Stay Ahead in Tech
Get the latest IT news, programming updates, and technology trends directly on your phone.
Your daily dose of tech, straight to your feed.
16 people found this page helpful
