How to use JQuery Event live() Method

This article describe about jQuery Event live() Method.
  • 1923

jQuery Event live() Method

Multiple event handler attaches by the live() method in the selected element., and also define a function to run when the event occur.

Using the live() method attached the event handler that will work for both current and FUTURE element.

Syntax

$(selector).live(event,data,function)

 

Parameter Description
event Required. It is define one or more event to attached the element. And multiple event separated by the Space.
data Optional. Define the additional data to pass.
function Required. It is define the function to run when event occurs.

Example

<!DOCTYPE html>

<html>

<head>

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

<script type="text/javascript">

    $(document).ready(function () {

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

            $("p").slideToggle();

        });

    });

</script>

</head>

<body>

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

<button>Click me</button>

</body>

</html>

 

Output

live method pic43.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.