How to use jQuery event

jQuery's methods for event

MethodDescription
.bind()Binds an event handler
.delegate()Binds a handler to one or more events currently or in the future
.die()Removes event handlers add using the .live() method
.live()Binds a handler currently or in the future
.one()Attaches an event handler that is executed at most once
.proxy()Takes a function and returns another belonging to a specifi ed context
.trigger()Executes event handlers attached to an element for an event type
.triggerHandler()Executes all handlers for a specifi c event
.unbind()Removes event bindings created with .bind()
.undelegate()Removes bindings created with .delegate()

Event handler

jQuery event handlers.

  • .blur()
  • .focus()
  • .select()
  • .submit()
  • .click()
  • .dblclick()
  • .focusin()
  • .focusout()
  • .hover()
  • .mousedown()
  • .mouseenter()
  • .mousemove()
  • .mouseout()
  • .mouseover()
  • .mouseup()
  • .toggle()
  • .error()
  • .resize()
  • .scroll()

Event object

The Event object passed into the handlers is normalized and is of the type jQuery.Event.

It contains the properties outlined in the following list:

PropertyDescription
altKeytrue if the Alt key was pressed.
attrChange
attrName
Bubbles
Button
Cancelable
charCode
Client
Client
ctrlKeytrue if the Ctrl key was pressed.
currentTarget
datapassed as the second parameter to the bind() command.
detail
eventPhase
fromElement
handler
keyCodeFor keyup and keydown events, returns the pressed key.
layerX
layerY
metaKeytrue if the Meta key was pressed.
newValue
Offset
originalTarget
pageXFor mouse events, horizontal coordinate.
pageYFor mouse events, vertical coordinate.
prevValue
relatedNode
relatedTargetFor some mouse events, cursor left or entered when the event was triggered.
Screen
screenXFor mouse events, horizontal coordinate.
screenYFor mouse events, coordinate from the screen origin.
shiftKeySet to true if the Shift key was pressed.
srcElement
target
toElement
View
wheelDelta
which




















Home »
  jQuery »
    jQuery Tutorial »




Basics
Selector
DOM
Event
Effect
Utilities