jQuery | event.isImmediatePropagationStopped() Method

The isImmediatePropagationStopped() Method in jQuery is used to check whether this method was called for the event or not. If it was called then it will be “true” or else “false”.

Syntax:

$(selector).isImmediatePropagationStopped()

Parameter: This method accepts only one parameter as a selector which is used to select the element.



Return value: This method returns true if event.stopImmediatePropagation() is called or it will return false if not called.

Example-1:

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
  
<head>
    <script src=
  </script>
    <style>
        body {
            width: 60%;
            height: 40%;
            padding: 20px;
            border: 2px solid green;
        }
          
        div {
            padding: 5px;
            display: block;
            background-color: lightgrey;
            font-size: 20px;
        }
    </style>
    
  <script>
      $(document).ready(function() {
         $("div").click(function(event) {
            event.stopImmediatePropagation();
            alert(
            "Was event.stopImmediatePropagation() called: "
             + event.isImmediatePropagationStopped());
         });
     });
  </script>
</head>
  
<body>
  
    <div>Welcome to GeeksforGeeks..!</div>
  
</body>
  
</html>

chevron_right


Output:
Before click on the div element:

After click on the div element:

Example-2:

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
  
<head>
    <script src=
  </script>
    <style>
        body {
            width: 60%;
            height: 40%;
            padding: 20px;
            border: 2px solid green;
        }
          
        div {
            padding: 5px;
            display: block;
            background-color: lightgrey;
            font-size: 20px;
        }
    </style>
     
  <script>
    $(document).ready(function() {
     $("div").click(function(event) {
      alert(
      "Value of event.stopImmediatePropagation() called: "
        + event.isImmediatePropagationStopped());
     });
  });
  </script>
</head>
  
<body>
  
    <div>Welcome to GeeksforGeeks..!</div>
  
</body>
  
</html>

chevron_right


Output:
Before click on the “div” element:

After click on the “div” element:



My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.