Dublin Library

The Publishing project

Partial List of Events

In this post

    This post is a continuation of the last post about Javascript events. It will give a partial list of events available to Javascript browsers, whether they bubble up to parent chain and a brief description.

    Knowing whether an even bubbles or not is important since it may change the way you write code.

    The first block of events are triggered in the window or document objects.

    EventBubblesDescription
    Window/Document Events
    loadNoFired when the whole page (including external resources) is fully loaded.
    unloadNoFired when the page is unloading from the browser.
    beforeunloadNoFired when the user is about to leave the page (e.g., closing tab, navigating away).
    resizeNoFired when the window is resized.
    scrollYesFired when the window or an element is scrolled.
    hashchangeNoFired when the URL hash (fragment identifier) changes.
    popstateNoFired when the active history entry changes (for single-page applications using history API).
    onlineNoFired when the browser goes online.
    offlineNoFired when the browser goes offline.
    orientationchangeNoFired when the device orientation changes.

    Focus events are fired when an element gains or loses focus. The difference between the two pairs of events (focus/blur and focusin/focusout) is that the latter pair bubble and the other one doesn’t.

    EventBubblesDescription
    Focus Events
    focusNoFired when an element (e.g. input) gains focus (does not bubble).
    blurNoFired when an element loses focus (does not bubble).
    focusinYesSimilar to focus, but bubbles.
    focusoutYesSimilar to blur, but bubbles.

    Form events are specific to forms and their children. Some of these inputs are specific to some types of form children elements.

    EventBubblesDescription
    Form Events
    inputYesFired when the value of an input or textarea changes.
    changeYesFired when an element’s value is changed and the element loses focus (for select/radio/checkbox).
    submitNoFired when a form is submitted.
    resetNoFired when a form is reset.
    selectNoFired when text in a text field is selected.

    Keyboard events deal with keyboard changes and updates.

    EventBubblesDescription
    Keyboard Events
    keydown
    deprecated
    YesFired when a key is pressed down.
    keypressYes*Fired when a character-producing key is pressed down.
    keyupYesFired when a key is released.

    There are set of mouse specific events… You should be careful when using these events since you have no way to predict what type of device your users will use to access your content. See also the touch and pointer events.

    EventBubblesDescription
    Mouse Events
    clickYesFired when a pointing device button (usually the primary button) is clicked.
    dblclickYesFired when a pointing device button is double-clicked.
    mousedownYesFired when a pointing device button is pressed down on an element.
    mouseupYesFired when a pointing device button is released over an element.
    mousemoveYesFired when a pointing device is moved inside an element.
    mouseoverYesFired when a pointing device is moved onto an element or one of its children.
    mouseoutYesFired when a pointing device is moved off an element and its children.
    mouseenterNoSimilar to mouseover, but does not bubble; only fires when the pointer enters the element itself.
    mouseleaveNoSimilar to mouseout, but does not bubble; only fires when the pointer leaves the element itself.
    contextmenuYesFired when the right mouse button is clicked (or a context menu key is pressed).

    Pointer events are a combination of touch and mouse events designed to support a wider variety of devices used to access web content.

    EventBubblesDescription
    Pointer Events
    pointerdownYesFired when a pointer (mouse, pen, touch) is pressed down.
    pointerupYesFired when a pointer is released.
    pointermoveYesFired when a pointer changes coordinates.
    pointeroverYesFired when a pointing device moves onto an element or its descendants.
    pointeroutYesFired when a pointing device moves away from an element and its descendants.
    pointerenterNoFired when a pointing device moves onto the element (no bubbling).
    pointerleaveNoFired when a pointing device moves out of the element (no bubbling).
    pointercancelYesFired when a pointer is canceled, often due to a hardware event.
    gotpointercaptureYesFired when an element receives pointer capture.
    lostpointercaptureYesFired when an element loses pointer capture.

    Both the drag and drop and clipboard APIs generate their own events.

    EventBubblesDescription
    Drag & Clipboard Events
    dragYesFired when an element is being dragged.
    dragstartYesFired when the user starts dragging an element.
    dragendYesFired when a drag operation ends.
    dragenterYesFired when a dragged element enters a drop target.
    dragleaveYesFired when a dragged element leaves a drop target.
    dragoverYesFired when a dragged element is over a drop target.
    dropYesFired when a dragged element is dropped on a valid drop target.
    copyYesFired when the user copies content to the clipboard.
    cutYesFired when the user cuts content to the clipboard.
    cutYesFired when the user cuts content to the clipboard.
    pasteYesFired when the user pastes content from the clipboard.

    Media Events are fired when the status of a media element changes.

    EventBubblesDescription
    Media Events
    playNoFired when playback of media starts or resumes.
    pauseNoFired when playback of media is paused.
    endedNoFired when media has reached the end.
    volumechangeNoFired when the volume or mute state of the media changes.
    timeupdateNoFired when the playing position of the media changes (e.g., due to user seeking).
    canplayNoFired when the browser can start playing media (but may still need buffering).
    canplaythroughNoFired when the browser estimates it can play media to the end without buffering.
    seekingNoFired when the user starts moving the play position indicator.
    seekedNoFired when the user finishes moving the play position indicator.

    Animation and transition-related events. These animations can be triggered either from CSS or Javascript using the Web Animations API

    EventBubblesDescription
    Animation & Transition Events
    animationstartYesFired when a CSS animation starts.
    animationendYesFired when a CSS animation ends.
    animationiterationYesFired when a CSS animation repeats.
    transitionstartYesFired when a CSS transition starts.
    transitionendYesFired when a CSS transition completes.
    transitionrunYesFired when a CSS transition is created.
    transitioncancelYesFired when a CSS transition is canceled.

    All the following events fall outside the previous categories

    EventBubblesDescription
    Miscellaneous Events
    wheelYesFired when the wheel button of a pointing device is rotated.
    messageNoFired when a message is received through a MessagePort or a Web Worker.
    errorNoFired when an error occurs (varies by context, e.g. script load error or media error).
    abortNoFired when a resource loading is aborted.
    toggleYesFired when the open/closed state of a <details> element changes.