Die() Method Event In JQuery

jQuery Event die() Method

The die() method remove multiple event handler, for selected elements which are added with the live().

Syntax

$(selector).die(event,function)

 

ParameterDescription
EventRequired. It is define one or more method to the remove.
functionOptional. It is define a specific function to remove.

Example:

<!DOCTYPE html>

<html>

<head>

<script type="text/javascript" src="jquery.js"></script>

<script type="text/javascript">

    $(document).ready(function () {

        $("p").live("click", function () {

            $(this).slideToggle();

        });

        $("button").click(function () {

            $("p").die();

        });

    });

</script>

</head>

<body>

<p>This is my first paragraph.</p>

<p>This is second paragraph.</p>

<p>Click on any p element to make it disappear. Including this one also.</p>

<button>Remove event handlers, added with the live() method, for p elements</button>

</body>

</html>

 

Output


die method pic13.jpg

You may also want to read these related articles Click here