jQuery & jQuery UI Documentation

jQuery & jQuery UI

event.isImmediatePropagationStopped()

event.isImmediatePropagationStopped() Returns: Boolean

Description: Returns whether event.stopImmediatePropagation() was ever called on this event object.

  • version added: 1.3event.isImmediatePropagationStopped()

This property was introduced in DOM level 3.

Example:

Checks whether event.stopImmediatePropagation() 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 immediatePropStopped(e) {
  var msg = "";
  if ( e.isImmediatePropagationStopped() ) {
    msg =  "called"
  } else {
    msg = "not called";
  }
  $("#stop-log").append( "<div>" + msg + "</div>" );
}

$("button").click(function(event) {
  immediatePropStopped(event);
  event.stopImmediatePropagation();
  immediatePropStopped(event);
});  
</script>

</body>
</html>