How to use die() Method event in jQuery

This article describe about die() Method event in jQuery.
  • 2154

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)

 

Parameter Description
Event Required. It is define one or more method to the remove.
function Optional. 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

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

Categories

More Articles

© 2019 DotNetHeaven. All rights reserved.