Easy Tutorial
❮ Sel Multiple Classes Event Delegate ❯

jQuery live() Method

jQuery Event Methods

Example

Hide or show the <p> element when a button is clicked:


Definition and Usage

The live() method adds one or more event handlers to the selected elements and specifies a function to run when these events occur.

Event handlers added by the live() method apply to the current and future elements that match the selector (such as new elements created by scripts).

Tip: To remove event handlers, use


Syntax

Parameter Description
event Required. Specifies one or more events to be added to the elements. <br> <br>Multiple event values are separated by spaces. Must be valid events.
data Optional. Specifies additional data to be passed to the function.
function Required. Specifies the function to run when the event occurs.

More Examples

Add Event Handlers to Future Elements


jQuery Event Methods

❮ Sel Multiple Classes Event Delegate ❯