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
fas 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
fas a handler for events of the specifiedtypeon each of the selected elements. Ifdatais specified, add it to the event object before invokingf.typemay 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
fas a live event handler.fwill be triggered when events of typetypeoccur on an element matchingseland bubble up to any of the selected elements. Ifdatais specified, it will be added to the event object beforefis invoked.die(type, [f(event)])Deregisters live event handlers registered with
live()for events of typetypeon elements that match the selector string of the current selection. If a specific event handler functionfis specified, only deregister that one.hover( ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access