jQuery callbacks.fired() Method — Check If Fired

Beginner
5 min read
Updated: Nov 2026
3 examples
Callbacks

Definition

callbacks.fired() returns a Boolean: true if fire() or fireWith() has run at least once on that list (since jQuery 1.7). It does not invoke handlers.

Syntax

Start with these common calls. Keep them short and readable.

jQuery
callbacks.fired()   // false before any fire
callbacks.fire("x")
callbacks.fired()   // true after

fire()  → run handlers (action)
fired() → boolean status (question)
CallWhat it does
Callbacks objectFrom $.Callbacks()
Argumentsfired() takes no parameters
ReturnBoolean — has the list fired?

Load jQuery before your script (CDN or local file), then wrap DOM work in $(function () { ... }) when needed.

Parameters

ParameterDescription
Step 1Create a list and optionally add() handlers.
Step 2Call fired() before any fire — expect false.
Step 3Call fire() or fireWith() when ready.

Return Value

Return ValueDescription
BooleanOften true or false depending on the match or state.

jQuery Examples

Example 1 — Check After fire()

Official style: fire the list, then call fired().

jQuery
var foo = function (value) {
  console.log("foo: " + value);
};

var callbacks = $.Callbacks();
callbacks.add(foo);
callbacks.fire("hello");
callbacks.fire("world");

console.log(callbacks.fired());  // true
Try It Yourself

How It Works

  1. Register foo with add().
  2. Fire twice — handlers run each time.
  3. Ask. fired() returns true because invocation happened.

Example 2 — False Before Any Fire

A fresh list has not been invoked yet.

jQuery
var cbs = $.Callbacks();
cbs.add(function () { /* ... */ });

console.log(cbs.fired());  // false

cbs.fire();
console.log(cbs.fired());  // true
Try It Yourself

How It Works

  1. Create a list and optionally add handlers.
  2. Before fire. fired() is false.
  3. After fire. The same call returns true.

Example 3 — Still True With once

Ignored second fires do not reset the flag.

jQuery
var cbs = $.Callbacks("once");
cbs.add(function (msg) { console.log(msg); });

cbs.fire("first");
console.log(cbs.fired());  // true

cbs.fire("second");        // ignored
console.log(cbs.fired());  // still true
Try It Yourself

How It Works

  1. once allows only the first fire() to run handlers.
  2. First fire sets the fired flag.
  3. Second fire is a no-op for handlers.

Frequently Asked Questions

fired() returns true if fire() or fireWith() has been called on the list at least once; otherwise false. It is a status check only — it does not invoke handlers.
No. fired() accepts no arguments. Flags such as once or memory belong on $.Callbacks("…") when you create the list.
fire() is the action that runs handlers. fired() answers whether that action has happened at least once. It returns a boolean and does not change the list.
After the first successful fire() or fireWith(). It remains true even if later fires are ignored (for example with the once flag).
fired() tracks whether the list has been invoked. disabled() tracks whether disable() shut the list down. A list can be fired but not disabled, or disabled without ever firing.
Use it to skip duplicate init, assert teardown only after init ran, debug late subscribers (with memory), or write tests that verify fire() was called.

Next: callbacks.disable() Method — Shut Down a List

Learn how to permanently shut down a Callbacks list.

callbacks.disable() Method — Shut Down a List tutorial →

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.

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

7 people found this page helpful