Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

jQuery event methods

jQuery Event Methods


jQuery event methods

Event methods trigger an event or add a function to the event handler of the selected elements.

The following table lists all jQuery methods for handling events.

Method Description
bind() Add an event handler to elements
blur() Add/trigger a blur event
change() Add/trigger a change event
click() Add/trigger a click event
dblclick() Add/trigger a dblclick event
delegate() Add a handler to the current or future children of matched elements
die() Removed in version 1.9. Remove all event handlers added via the live() method
error() Deprecated in version 1.8. Add/trigger an error event
event.currentTarget The current DOM element within the event bubbling phase
event.data Contains optional data passed to the event method when the currently executing handler was bound
event.delegateTarget Return the element to which the currently invoked jQuery event handler was added
event.isDefaultPrevented() Return whether event.preventDefault() was called on the specified event object
event.isImmediatePropagationStopped() Return whether event.stopImmediatePropagation() was called on the specified event object
event.isPropagationStopped() Return whether event.stopPropagation() was called on the specified event object
event.namespace Return the namespace specified when the event was triggered
event.pageX Return the mouse position relative to the left edge of the document
event.pageY Return the mouse position relative to the top edge of the document
event.preventDefault() Prevent the default behavior of the event
event.relatedTarget Return which element is entered or exited when the mouse moves
event.result Contains the last value returned by the event handler triggered by the specified event
event.stopImmediatePropagation() Prevent other event handlers from being called
event.stopPropagation() Prevent the event from bubbling up the DOM tree, preventing any parent handlers from being notified
event.target Return which DOM element triggered the event
event.timeStamp Return the number of milliseconds from January 1, 1970 to when the event was triggered
event.type Return which event type was triggered
event.which Return which keyboard key or mouse button was pressed on the specified event
event.metaKey Whether the META key was pressed when the event was triggered
focus() Add/trigger a focus event
focusin() Add an event handler to the focusin event
focusout() Add an event handler to the focusout event
hover() Add two event handlers to the hover event
keydown() Add/trigger a keydown event
keypress() Add/trigger a keypress event
keyup() Add/trigger a keyup event
live() Removed in version 1.9. Add one or more event handlers to current or future selected elements
load() Deprecated in version 1.8. Add an event handler to the load event
mousedown() Add/trigger a mousedown event
mouseenter() Add/trigger a mouseenter event
mouseleave() Add/trigger a mouseleave event
mousemove() Add/trigger a mousemove event
mouseout() Add/trigger a mouseout event
mouseover() Add/trigger a mouseover event
mouseup() Add/trigger a mouseup event
off() Remove event handlers added via the on() method
on() Add an event handler to elements
one() Add one or more event handlers to the selected elements. Each handler can be triggered only once per element
$.proxy() Accept an existing function and return a new function with a specific context
ready() Specify a function to execute when the DOM is fully loaded
resize() Add/trigger a resize event
scroll() Add/trigger a scroll event
select() Add/trigger a select event
submit() Add/trigger a submit event
toggle() Removed in version 1.9. Add two or more functions to toggle between on click events
trigger() Trigger all events bound to the selected elements
triggerHandler() Trigger all functions bound to the specified event on the selected elements
unbind() Remove added event handlers from the selected elements
undelegate() Remove event handlers from current or future selected elements
unload() Deprecated in version 1.8. Add an event handler to the unload event
contextmenu() Add an event handler to the contextmenu event
$.holdReady() Used to pause or resume the execution of the .ready() event