jwallace.us

tech, tunes, and other stuff

jQuery Notes: Javascript Events

Javascript (and hence jQuery) wouldn’t be very useful without the ability to handle events. ┬áThere are four basic types of events:

  • mouse events
  • document and window events
  • form events
  • keyboard events

There are three basic categories of mouse events:

  • When a mouse button is engaged
  • When the mouse button is disengaged
  • When a mouse is clicked
Mouse Events
event description
click fires after the mouse button is clicked and released
dblClick fires after the mouse button is clicked and released twice in quick succession
mousedown fires when a mouse button is depressed, but not released
mouseup fires when a mouse button is released after being depressed
mouseover fires when a mouse pointer is moved over an element
mouseout fires when a mouse pointer is moved off an element
mousemove fires when a mouse pointer is moved
Document and Window Events
event description
load
resize
scroll
unload
Form Events
event description
submit
reset
change fired when a form’s field has changed
focus fires when a text field is entered
blur fires when the currently focused field is exited

 

Keyboard Events
event description
keypress continually fires while a key is pressed down
keydown fires when a key is pressed down (and just before the keypress event)
keyup fired when a key is released

This page is a summary of information found in: JavaScript and jQuery: The Missing Manual, pp157-162