.live()    **REMOVED**S2C Home « Events « .live()

Attach event handlers.

Description

The .live() method is used to henceforth, attach an event handler to all elements matching the current selector for the given event type(s).

  • Starting with jQuery version 1.7 more flexible event delegation can be achieved by using the .on() and .off() methods. The .on() method allows us to attach event handlers directly to a document and is the preferred method to use when using this version onwards.

This method was deprecated in jQuery 1.7 and removed in jQuery 1.10 and we are just showing it for completeness.

Syntax


Signature Description
.live( events, handler(eventObject) )Henceforth, attach an event handler to all elements matching the current selector for the given event type(s).
.live( events, data, handler(eventObject) )Henceforth, attach an event handler to all elements matching the current selector for the given event type(s), passing an object of data.
.live( eventTypes )Henceforth, attach an object of event type(s) and functions to all elements matching the current selector.

Parameters


Parameter Description Type
eventsA string containing one or more DOM event types or custom event names.String
handler(eventObject) )A function to execute when the event triggers.Function
eventTypesAn object of event type(s) and functions to execute for them.PlainObject

Return

A jQuery object.

go to home page Homepage go to top of page Top