Skip to content
kupriyanenko edited this page Dec 9, 2014 · 9 revisions

.on(event[, selector, data], handler)

event One or more space-separated event types and optional namespaces, such as click or keydown.myPlugin keyup.

selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element.

data Data to be passed to the handler in event.data when an event is triggered.

handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false.

Attach an event handler function for one or more events to the selected elements.

.one(event[, selector, data], handler)

event One or more space-separated event types and optional namespaces, such as click or keydown.myPlugin.

selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element.

data Data to be passed to the handler in event.data when an event is triggered.

handler A function to execute when the event is triggered.

Attach a handler to an event for the elements. The handler is executed at most once per element per event type.

.off(event[, handler])

event One or more space-separated event types and optional namespaces, or just namespaces, such as click, keydown.myPlugin, or .myPlugin.

handler A handler function previously attached for the event(s).

Remove an event handler.

.trigger(event)

event One or more space-separated event types and optional namespaces, such as click mouseover or submit.

Execute all handlers and behaviors attached to the matched elements for the given event type.