event.stopImmediatePropagation() halts the handler queue on the current element and stops bubbling. This tutorial covers the official jQuery p/div demo, blocking analytics handlers, comparing with stopPropagation() and return false, and checking state with isImmediatePropagationStopped().
01
Method
stopImmediatePropagation()
02
Returns
undefined
03
Official
p vs div demo
04
Same element
Skip handlers
05
Bubbling
Implicit stopProp
06
Since 1.3
No arguments
Fundamentals
Introduction
When multiple handlers are bound to the same element with .on(), jQuery runs them in registration order during one dispatch. Sometimes an early handler must stop the rest — not just parent bubbling, but every remaining listener on that element.
event.stopImmediatePropagation() does exactly that. jQuery has exposed this method since version 1.3 on its normalized event object. The official demo binds two handlers to p — the first calls stopImmediatePropagation(), so the second never runs — while a handler on sibling div still executes normally.
Concept
Understanding event.stopImmediatePropagation()
This method tells jQuery: stop running handlers on this element and do not bubble further.
Same element — remaining handlers registered on the current target are skipped.
Bubbling stopped — implicitly calls event.stopPropagation() so parent handlers do not run.
No arguments — call it with empty parentheses; returns undefined.
Check afterward — use event.isImmediatePropagationStopped() to verify the flag was set.
💡
Beginner Tip
Use stopImmediatePropagation() when you need to halt the handler queue on one element — not when you only want to block parent handlers. For bubbling alone, stopPropagation() is enough and lets other same-element handlers continue.
Foundation
📝 Syntax
Official jQuery API form (since 1.3):
jQuery
event.stopImmediatePropagation()
// typical pattern:
$( "button" ).on( "click", function ( event ) {
event.stopImmediatePropagation();
// remaining handlers on this button are skipped
});
Parameters
None — this method does not accept any arguments.
Return value
undefined — the method stops handlers and bubbling as a side effect. Use event.isImmediatePropagationStopped() to check state afterward.
Official jQuery API example
jQuery
$( "p" ).on( "click", function ( event ) {
event.stopImmediatePropagation();
});
$( "p" ).on( "click", function ( event ) {
// This function won't be executed
$( this ).css( "background-color", "#f00" );
});
$( "div" ).on( "click", function ( event ) {
// This function will be executed
$( this ).css( "background-color", "#f00" );
});
Cheat Sheet
⚡ Quick Reference
Goal
API
Effect
Skip remaining handlers + stop bubble
event.stopImmediatePropagation()
Handler queue halted
Check if called
event.isImmediatePropagationStopped()
Returns Boolean
Stop bubbling only
event.stopPropagation()
Same-element handlers may continue
jQuery shorthand
return false
prevent + stopPropagation (not immediate)
Cancel default action
event.preventDefault()
Separate concern
Compare
📋 stopImmediatePropagation() vs stopPropagation() vs return false vs isImmediatePropagationStopped()
Four related tools — halt the handler queue, stop bubbling only, jQuery shorthand, or read the flag.
stopImmediatePropagation
event.stopImmediatePropagation()
Skip remaining handlers + stop bubbling
stopPropagation
event.stopPropagation()
Stop bubbling; same-element handlers continue
return false
return false
prevent + stopPropagation (not immediate)
isImmediatePropagationStopped
event.isImmediatePropagationStopped()
Read flag (Boolean)
Hands-On
Examples Gallery
Example 1 follows the official jQuery p/div demo. Examples 2–5 cover analytics blocking, stop method comparison, document-level bubbling, and plugin guard patterns.
📚 Official jQuery Demo
First p handler stops immediate; second p handler skipped; div handler runs.
Example 1 — Official Demo: log which handlers run
Official jQuery demo — first p handler calls stopImmediatePropagation(); second p handler is skipped; clicking div runs its handler.
Click p → #log shows "p handler 1 ran — immediate stopped"
p handler 2 never runs
Click div → #log shows "div handler ran", div turns red
How It Works
stopImmediatePropagation() affects only the handler queue on the element where it was called. Sibling elements like div are unaffected — their handlers run normally when clicked.
Example 2 — Primary handler blocks analytics on same button
Primary click handler calls stopImmediatePropagation() when the action is handled — analytics handler on the same button never fires.
#status shows "Purchase handled by primary handler"
" | analytics tracked" never appears
How It Works
When a primary handler owns the click, stopping immediate propagation prevents secondary handlers — analytics, tooltips, or legacy plugins — from running on the same element.
📈 Practical Patterns
Compare stop methods, bubbling behavior, and plugin cooperation.
Example 3 — stopImmediatePropagation vs stopPropagation side-by-side
Two buttons demonstrate the difference — stopPropagation() lets a second handler run; stopImmediatePropagation() does not.
jQuery
// Button A — stopPropagation only
$( "#btn-a" ).on( "click", function ( event ) {
event.stopPropagation();
$( "#log-a" ).append( "Handler 1 (stopPropagation)\n" );
});
$( "#btn-a" ).on( "click", function () {
$( "#log-a" ).append( "Handler 2 still ran\n" );
});
// Button B — stopImmediatePropagation
$( "#btn-b" ).on( "click", function ( event ) {
event.stopImmediatePropagation();
$( "#log-b" ).append( "Handler 1 (stopImmediate)\n" );
});
$( "#btn-b" ).on( "click", function () {
$( "#log-b" ).append( "Handler 2 still ran\n" );
});
Button A: Handler 1 + Handler 2 both run
Button B: Handler 1 only — Handler 2 skipped
How It Works
stopPropagation() halts bubbling but not the same-element queue. stopImmediatePropagation() does both — use it when later handlers on that element must not run.
Example 4 — Inner handler stops immediate; document handler blocked
First handler on an inner span calls stopImmediatePropagation() — document-level click handler does not run because bubbling is also stopped.
#log shows "inner handler ran — bubbling stopped"
"inner handler 2" and "document handler ran" never appear
How It Works
Because stopImmediatePropagation() implicitly calls stopPropagation(), the event never reaches document. Both the handler queue and the bubble chain halt at the inner element.
Example 5 — Plugin pattern: guard with isImmediatePropagationStopped
Validation plugin stops immediate propagation on failure; fallback plugin checks the flag before running.
jQuery
// Validation plugin — bound first
$( "#save" ).on( "click", function ( event ) {
if ( !$( "#name" ).val() ) {
event.stopImmediatePropagation();
$( "#msg" ).text( "Validation failed" );
}
});
// Fallback plugin — bound second, guards before running
$( "#save" ).on( "click", function ( event ) {
if ( event.isImmediatePropagationStopped() ) return;
$( "#msg" ).text( "Save handler ran — form would submit." );
});
Empty name → #msg shows "Validation failed", save handler skipped
Filled name → #msg shows "Save handler ran — form would submit."
How It Works
Cooperative plugins use stopImmediatePropagation() to halt the queue and isImmediatePropagationStopped() to detect when an earlier handler already stopped it.
Applications
🚀 Common Use Cases
Handler ownership — primary handler stops immediate propagation so legacy or analytics handlers on the same element do not run.
Validation gates — fail fast on invalid input and skip save or submit handlers bound later.
Plugin conflicts — one plugin stops the queue when it handles the event exclusively.
Exclusive UI modes — modal or overlay handler prevents other click listeners on the same trigger.
Event delegation edge cases — child handlers may stop immediate propagation before delegated parent logic on the same element runs.
Debugging handler order — pair with isImmediatePropagationStopped() to trace which handler halted the queue.
🧠 How stopImmediatePropagation() Works
1
Event fires
User clicks an element with multiple bound handlers — jQuery starts the handler queue in registration order.
Trigger
2
Early handler runs
First handler calls event.stopImmediatePropagation() when it must own the dispatch.
Handler
3
Queue halted + bubble stopped
Remaining same-element handlers are skipped. Bubbling stops via implicit stopPropagation().
Stop
4
✓
Exclusive handling
Only handlers that ran before the stop execute. Use isImmediatePropagationStopped() to verify the flag.
Important
📝 Notes
Available since jQuery 1.3 — returns undefined.
Takes no arguments — call with empty parentheses.
Stops remaining handlers on the same element and stops bubbling.
Implicitly calls event.stopPropagation() — parent handlers do not run.
Does not call preventDefault() — cancel defaults separately if needed.
return false in jQuery handlers calls preventDefault plus stopPropagation, not stopImmediatePropagation.
Use event.isImmediatePropagationStopped() (jQuery 1.3+) to check whether this method was called.
Compatibility
Browser Support
event.stopImmediatePropagation() is part of jQuery’s normalized event object since jQuery 1.3+. It wraps the native DOM stopImmediatePropagation() method so halting the handler queue and stopping bubbling works consistently across browsers jQuery supports.
✓ jQuery 1.3+ · all browsers
jQuery event.stopImmediatePropagation()
Halt handler queues and stop bubbling reliably.
100%Universal
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
stopImmediatePropagation()undefined
Bottom line: Call stopImmediatePropagation() to halt the queue — call isImmediatePropagationStopped() to verify.
Wrap Up
Conclusion
event.stopImmediatePropagation() is the strongest stop available on jQuery’s event object — it skips remaining handlers on the same element and prevents bubbling. The official p/div demo shows how it blocks a second p handler while leaving sibling div handlers untouched.
Reach for it when one handler must own the dispatch — validation, primary actions, or plugin conflicts — and use isImmediatePropagationStopped() when later code needs to detect whether the queue was already halted.
Call event.stopImmediatePropagation() explicitly when you must skip remaining handlers
Bind the owning handler first if it should run before others
Pair with isImmediatePropagationStopped() in cooperative multi-handler setups
Use when validation failure should block all subsequent handlers on the element
Prefer stopPropagation when same-element handlers should still run
❌ Don’t
Confuse with stopPropagation() — they halt different things
Assume return false stops the same-element handler queue
Call stopImmediatePropagation when stopPropagation alone is enough
Use it to cancel default browser actions — call preventDefault instead
Stop immediate propagation on delegated events expecting to block handlers below in the DOM tree that already ran
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about stopImmediatePropagation()
Halt handler queues and bubbling.
5
Core concepts
stop01
stopImmediate
Skip handlers + bubble
API
∅02
Returns
undefined
Value
demo03
Official
p vs div
Demo
queue04
Same element
Handler queue
Use
≠05
Not stopProp
Stronger stop
Compare
❓ Frequently Asked Questions
event.stopImmediatePropagation() keeps any remaining handlers on the same element from running and prevents the event from bubbling up the DOM tree. It implicitly calls stopPropagation(). It takes no arguments and returns undefined. Available since jQuery 1.3.
Call it when an early handler on an element must halt the handler queue — for example, a validation handler that should block analytics and save handlers bound to the same button, or a primary click handler that owns the interaction.
stopPropagation() stops bubbling to parent elements but other handlers on the same element still run. stopImmediatePropagation() stops both remaining same-element handlers and bubbling in one call.
No. In jQuery handlers, return false calls preventDefault() and stopPropagation(), not stopImmediatePropagation(). Remaining handlers on the same element may still run unless you explicitly call stopImmediatePropagation().
Use event.isImmediatePropagationStopped(). It returns true if stopImmediatePropagation() was called on this event object during the current dispatch, and false otherwise.
No. stopImmediatePropagation() affects handler execution and bubbling only. To cancel default actions like link navigation or form submit, call event.preventDefault() separately.
Did you know?
event.stopImmediatePropagation() was added in jQuery 1.3 alongside isImmediatePropagationStopped(), isPropagationStopped(), and isDefaultPrevented() — giving handlers both action methods and read-only checks for the three main event flags. The behavior mirrors DOM Level 3’s native stopImmediatePropagation().