Check if event.stopImmediatePropagation()
was called:
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"> </script>/*from w w w . j a va 2 s . c om*/ <script> $(document).ready(function(){ $("div").click(function(event){ event.stopImmediatePropagation(); document.getElementById("demo").innerHTML = "Was event.stopImmediatePropagation() called: " + event.isImmediatePropagationStopped(); }); }); </script> </head> <body> <p id="demo"></p> <div style="height:100px;width:300px;padding:10px;background-color:lightblue;">Click on this div element.</div> </body> </html>
jQuery event.isImmediatePropagationStopped()
method checks whether the event.stopImmediatePropagation()
was called.
This method returns true if event.stopImmediatePropagation()
is called, and false if not.
event.isImmediatePropagationStopped()
Parameter | Optional | Description |
---|---|---|
event | Required. | The event parameter comes from the event binding function |