event.isPropagationStopped()
event.isPropagationStopped() Returns: Boolean
Description: Returns whether event.stopPropagation() was ever called on this event object.
-
version added: 1.3event.isPropagationStopped()
This event method is described in the W3C DOM Level 3 specification.
Example:
Checks whether event.stopPropagation() was called
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-1.7rc2.js"></script>
</head>
<body>
<button>click me</button>
<div id="stop-log"></div>
<script>
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);
});
</script>
</body>
</html>