jQuery event.isPropagationStopped() Method (original) (raw)

Last Updated : 11 Jan, 2024

**jQuery **event.isPropagationStopped() Method is used to check whether the object event.stopPropagation() is called or not. If event.stopPropagation() is called then it returns true otherwise returns false.

**Syntax:

event.isPropagationStopped()

**Parameters:

It contains a single parameter **event which is mandatory. This parameter comes from the event binding function.

**Example 1: This example uses event.isPropagationStopped() method to check event.stopPropagation() is called or not.

HTML `

<script>
    $(document).ready(function () {
        $("button").click(function (event) {
            event.stopPropagation();
            alert("Is event.stopPropagation() called: "
                + event.isPropagationStopped());
        });
    });
</script>

jQuery event.isPropagationStopped() Method

click on button to check if the event.stopPropagation() is called.

Check

`

**Output:

**Example 2: This example uses event.isPropagationStopped() method to check event.stopPropagation() is called or not.

HTML `

event.isPropagationStopped method

jQuery event.isPropagationStopped() Method

click on button to check if the event.stopPropagation() is called.

Check
<script>
    function propStopped(event) {
        let message = "";

        if (event.isPropagationStopped()) {
            message = "True";
        }
        else {
            message = "False";
        }

        $("#GFG").append("<div>" + message + "</div>");
    }

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

`

**Output: