event.isPropagationStopped()
Categories: Event Object
event.isPropagationStopped()Returns: Boolean
Description: Returns whether event.stopPropagation() was ever called on this event object.
-
event.isPropagationStopped()
version added: 1.0
This event method is described in the W3C DOM Level 3 specification.
-
Checks whether event.stopPropagation() was called
HTML:
<button>click me</button> <div id="stop-log"></div>
Code:
function propStopped(e) { var msg = ""; if ( e.isPropagationStopped() ) { msg = "called" } else { msg = "not called"; } $("#stop-log").append( "<div>" + msg + "</div>" ); } $("button").click(function(event) { propStopped(event); event.stopPropagation(); propStopped(event); });