Monday, 11 April 2016

live() event in jquery

<html>
<head>
<title>live() event example</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("p").live("click",function(){
$(this).after("<p>This is Add Paragraph.</p>")
});
});
</script>
</head>
<body>
<p>This is a Paragraph.</p>
</body>
</html>

Note: If we use $('p').click(function) then the new p can't create new p so for this purpose jquery introduce another concept live().

0 comments:

Post a Comment