The DOM Events

The following table lists all dom events:

NameDescription
blurTriggered when the element loses the focus.
clickTriggered when the mouse button is pressed and released.
dblclickTriggered when the mouse button is pressed and released twice.
focusTriggered when the element gains the focus.
focusinTriggered when the element is just about to gain the focus.
focusoutTriggered when the element is just about to lose the focus.
keydownTriggered when the user presses a key.
keypressTriggered when a user presses and releases a key.
keyupTriggered when the use releases a key.
mousedownTriggered when the mouse button is pressed.
mouseenterTriggered when the pointer is moved to be within the screen region occupied by the element or one of its descendants.
mouseleaveTriggered when the pointer is moved to be outside the screen region occupied by the element and all its descendants.
mousemoveTriggered when the pointer is moved while over the element.
mouseoutThe same as for mouseleave, except that this event will trigger while the pointer is still over a descendant element.
mouseoverThe same as for mouseenter, except that this event will trigger while the pointer is still over a descendant element.
mouseupTriggered when the mouse button is released.
onabortTriggered when the loading of a document or resource is aborted.
onafterprintTriggered when the Window.print() method is called, before the user is presented with the print options.
onbeforeprintTriggered after the user has printed the document.
onerrorTriggered when there is an error loading a document or resource.
onhashchangeTriggered when the has fragment changes.
onloadTriggered when the loading of a document or resource is complete.
onpopstateTriggered to provide a state object associated with the browser history.
onresizeTriggered when the window is resized.
onunloadTriggered when the document is unloaded from the window/browser.
readystatechangeTriggered when the value of the readyState property changes.
resetTriggered when a form is reset.
submitTriggered when a form is submitted.

The members of the Event object are described in the following table.

NameDescriptionReturns
typeThe name of the event (e.g., mouseover).string
targetThe element at which the event is targeted.HTMLElement
currentTargetThe element whose event listeners are currently being invoked.HTMLElement
eventPhaseThe phase in the event life cycle.number
bubblesReturns true if the event will bubble through the document, false otherwise.boolean
cancelableReturns true if the event has a default action that can be cancelled, false otherwise.boolean
timeStampThe time at which the event was created, or 0 if the time isn't available.string
stopPropagation()Halts the flow of the event through the element tree after the event listeners for the current element have been triggered.void
stopImmediatePropagation()Immediately halts the flow of the event through the element tree; untriggered event listeners for the current element will be ignored.void
preventDefault()Prevents the browser from performing the default action associated with the event.void
defaultPreventedReturns true if preventDefault() has been called.boolean
Home 
  JavaScript Book 
    DOM  

DOM Event:
  1. The DOM Events
  2. Event Flow: capture, target, and bubbling
  3. eventPhase
  4. preventDefault: Cancellable Events
  5. Events Type
  6. Event Target