Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

36 lines (36 sloc) 1.761 kb
<?xml version="1.0"?>
<entry type="method" name="event.stopImmediatePropagation" return="">
<title>event.stopImmediatePropagation()</title>
<signature>
<added>1.3</added>
</signature>
<desc> Keeps the rest of the handlers from being executed and prevents the event from bubbling up the DOM tree.</desc>
<longdesc>
<p>In addition to keeping any additional handlers on an element from being executed, this method also stops the bubbling by implicitly calling <code>event.stopPropagation()</code>. To simply prevent the event from bubbling to ancestor elements but allow other event handlers to execute on the same element, we can use <code><a href="http://api.jquery.com/event.stopPropagation">event.stopPropagation()</a></code> instead.</p>
<p>Use <code><a href="http://api.jquery.com/event.isImmediatePropagationStopped">event.isImmediatePropagationStopped()</a></code> to know whether this method was ever called (on that event object).</p>
</longdesc>
<note id="propagation-for-live-or-delegate" type="additional"/>
<example>
<desc>Prevents other event handlers from being called.</desc>
<css><![CDATA[
p { height: 30px; width: 150px; background-color: #ccf; }
div {height: 30px; width: 150px; background-color: #cfc; }
]]></css>
<code><![CDATA[
$("p").click(function(event){
event.stopImmediatePropagation();
});
$("p").click(function(event){
// This function won't be executed
$(this).css("background-color", "#f00");
});
$("div").click(function(event) {
// This function will be executed
$(this).css("background-color", "#f00");
});]]></code>
<html><![CDATA[<p>paragraph</p>
<div>division</div>]]></html>
</example>
<category slug="events/event-object"/>
<category slug="version/1.3"/>
</entry>
Jump to Line
Something went wrong with that request. Please try again.