jquery events

the jquery event methods are used to register behaviors to take effect when the user interacts with the browser.

the jquery event methods are divided in to several types.

  • browser events
  • document loading events
  • event object
  • event attachment
  • form events
  • mouse events
  • keyboard events

browser events

event methoddescription
error()triggers the error event of each matched element.
resize()triggers the resize event.
scroll()triggers the scroll event.

document loading events

event methoddescription
load()bind an event handler to the 'load' event.
ready()specify a function to execute when the dom is full loaded.
unload()bing an event handler to the 'unload' event.

form events

event methoddescription
blur()triggers the blur event.
change()triggers the change event.
focus()bind an event handler to the 'focus' event.
focusin()attaches an event handler to the 'focusin' event.
select()attaches an event handler to the 'select' event.
submit()attaches/triggers the submit event.

mouse events

event methoddescription
click()triggers the click event of each matched element.
dbclick()triggers the dbclick event of each matched element.
focusout()bind an event handler to the 'focusout' event.
hover()attaches two event handlers to the hover event.
mousedown()attaches/triggers the mousedown event.
mouseenter()attaches/triggers the mouseenter event.
mouseleave()attaches/triggers the mouseleave event.
mousemove()attaches/triggers the mousemove event.
mouseout()attaches/triggers the mouseout event.
mouseover()attaches/triggers the mouseover event.
mouseup()attaches/triggers the mouseup event.

keyboard events

event methoddescription
keydown()attaches an event handler to the 'keydown' event.
keypress()attaches an event handler to the 'keypress' event.
keyup()attaches an event handler to the 'keyup' event.

event attachment methods

methoddescription
bind()attach event handler to an elements.
delegate()attaches a handler to current, or future specified child elements of the matching elements.
die()remove the previously attached event handlers.
$.proxy()--
live()its close in jquery 1.9 version
off()remove an event handler
on()attachs an event handlers to elements.
one()attach one or more event handlers to selected element.this handler can only be triggered once pre element.
trigger()triggers all events bound to the selected elements.
triggerhandler()triggers all functions bound to a specified event for the selected elements.
unbind()remove a previously-attached event handler from the elements.
undelegate()removes an event handler to selected elements,current or in the future.

event object methods

methoddescription
event.currenttargetthe current dom element within the event bubbling phase.
event.datacontain an optional object of data passed to an event method when

the current executing handler is bound.
event.delegatetargetreturns the element where the currently-called jquery event handler

was attached.
event.isdefaultprevented()return whether event.preventdefault() was ever called on this event object.
event.ispropagationstopped()returns whether event.stoppropagation() was ever called for this event object.
event.metakeyindicates whether the meta key was pressed when the event fired.
event.namespacespecifies when the event was triggered
event.pagexthe mouse position relative to the left edge of the document.
event.pageythe mouse position relative to the top edge of the document.
event.preventdefault()this method call, if default action of the event will not be triggered.
event.relatedtarget()which element being entered or exited on mouse movement.
event.resultcontains the last/previous value returned by an event handler

trigger by the specified event.
event.stoppropagation()prevents the event from bubbing up the dom tree, preventing any

parent handlers from being notified of the event.
event.targetthe dom element that initiated the event.
event.timestamp---
event.typespecifies the type of the event.
event.whichreturns which mouse button or keyboard key pressed for the event.