Event Methods
The methods in this section are for registering event handlers and triggering events; see Chapter 4.
event-type
()
event-type
(
f
(event
))Register
f
as a handler forevent-type
, or trigger an event ofevent-type
. jQuery defines the following convenience methods that follow this pattern:ajaxComplete blur focusin mousedown mouseup ajaxError change focusout mouseenter resize ajaxSend click keydown mouseleave scroll ajaxStart dblclick keypress mousemove select ajaxStop error keyup mouseout submit ajaxSuccess focus load mouseover unload
bind(
type
, [data
],f
(event
))bind(
events
)Register
f
as a handler for events of the specifiedtype
on each of the selected elements. Ifdata
is specified, add it to the event object before invokingf
.type
may specify multiple event types and may include namespaces.If a single object is passed, treat it as a mapping of event types to handler functions, and register handlers for all the specified events on each selected element.
delegate(
sel
,type
, [data
],f
(event
))Registers
f
as a live event handler.f
will be triggered when events of typetype
occur on an element matchingsel
and bubble up to any of the selected elements. Ifdata
is specified, it will be added to the event object beforef
is invoked.die(
type
, [f
(event
)])Deregisters live event handlers registered with
live()
for events of typetype
on elements that match the selector string of the current selection. If a specific event handler functionf
is specified, only deregister that one.
Get jQuery Pocket Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.