Example of .die() in jQuery

May 02, 2013
.die() in jQuery kills the event on any element. Once the .die() function kills the event, then that event will not work on the calling event. After calling .live(), that event will start working. Syntax is
1.	.die()
2.	.die(event name)
 
First one will kill the entire event and second one will kill event wise. Find the example.

<!DOCTYPE html>
<html>
<head>
<style>p { color:blue; cursor:pointer } </style>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
</head>
<body>
<p>Click to test Die</p>
<script>
$("p").click(function(){
$("p").text( "Now click will not work." );
 $("p").die( "click" );
});

</script>
</body>
</html>
 

Output









©2023 concretepage.com | Privacy Policy | Contact Us