live() Method - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:live


The live() method was deprecated in jQuery version 1.7, and removed in version 1.9. Use the on() method instead.

The live() method attaches event handlers for both current and FUTURE elements.


Parameter Require Description
event or more events to attach to the elements.
data Optional. additional data to pass along to the function
function Required.the function to run when the event occurs

The following code shows how to Hide or show a <p> element when a button is clicked:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<script src="">
</script>// w w w. j  ava 2  s.  c  o m
    $("button").live("click", function(){

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

<button>Click me!</button>


Related Tutorials