Browser events in javascript

Event reference

Events are fired to notify code of «interesting changes» that may affect code execution. These can arise from user interactions such as using a mouse or resizing a window, changes in the state of the underlying environment (e.g. low battery or media events from the operating system), and other causes.

Each event is represented by an object that is based on the Event interface, and may have additional custom fields and/or functions to provide information about what happened. The documentation for every event has a table (near the top) that includes a link to the associated event interface, and other relevant information. A full list of the different event types is given in Event > Interfaces based on Event.

This topic provides an index to the main sorts of events you might be interested in (animation, clipboard, workers etc.) along with the main classes that implement those sorts of events. At the end is a flat list of all documented events.

Note: This page lists many of the most common events you’ll come across on the web. If you are searching for an event that isn’t listed here, try searching for its name, topic area, or associated specification on the rest of MDN.

Event index

Used to respond to changes in animation status (e.g. when an animation starts or ends).

Events related to the fetching data.

Used to notify when content is cut, copied, or pasted.

Events related to composition; entering text «indirectly» (rather than using normal keyboard presses).

For example, text entered via a speech to text engine, or using special key combinations that modify keyboard presses to represent new characters in another language.

Provides notification events when CSS transitions start, stop, are cancelled, etc.

Events related to database operations: opening, closing, transactions, errors, etc.

Events related to modifications to the Document Object Model (DOM) hierarchy and nodes.

Warning: Mutation Events are deprecated. Mutation Observers should be used instead.

Events related to using the HTML Drag and Drop API and wheel events.

Drag and Wheel events are derived from mouse events. While they are fired when using mouse wheel or drag/drop, they may also be used with other appropriate hardware.

Читайте также:  Sql execute update java

Wheel events fired on Document and Element

Events related to elements gaining and losing focus.

Events related to forms being constructed, reset and submitted.

Used to notify when the transitioning between full screen and windowed modes, and also of errors occurring during this transition.

Touch events are recommended for implementing gestures.

In addition there are a number of non-standard gesture events:

Events related to changing the state of a display or textual element.

Events related to HTML input elements e.g. , , or .

Events related to using a keyboard.

Used to notify when keys are moved up, down, or just pressed.

Events related to loading and unloading documents.

Events related to installation of progressive web app manifests.

Events related to a window receiving a message from another browsing context.

Events related to using a computer mouse.

Used to notify when the mouse is clicked, doubleclicked, up and down events, right-click, movement in and out of an element, text selection, etc.

Pointer events provide a hardware-agnostic alternative to mouse events. Drag and Wheel events are derived from mouse events.

Events related to gaining and losing network connection.

Provides hardware-agnostic notification from pointing devices including Mouse, Touch, pen/stylus.

Events related to printing.

Events sent to the global script context when any JavaScript promise is rejected.

Events related to SVG images.

Selection API events related to selecting text.

Provides notification events from interacting with a touch sensitive screen (i.e. using a finger or stylus). Not related to the Force Touch API.

Warning: The WebVR API (and associated Window events) are deprecated.

Used to respond to new messages and message sending errors. Service workers can also be notified of other events, including push notifications, users clicking on displayed notifications, that push subscription has been invalidated, deletion of items from the content index, etc.

Event listing

This section lists events that have their own reference pages on MDN. If you are interested in an event that isn’t listed here, try searching for its name, topic area, or associated specification on the rest of MDN.

  • AbortSignal
    • abort event
    • ended event
    • addtrack event
    • change event
    • removetrack event
    • messageerror event
    • message event
    • messageerror event
    • message event
    • animationcancel event
    • animationend event
    • animationiteration event
    • animationstart event
    • copy event
    • cut event
    • DOMContentLoaded event
    • dragend event
    • dragenter event
    • dragleave event
    • dragover event
    • dragstart event
    • drag event
    • drop event
    • fullscreenchange event
    • fullscreenerror event
    • gotpointercapture event
    • keydown event
    • keypress event
    • keyup event
    • lostpointercapture event
    • paste event
    • pointercancel event
    • pointerdown event
    • pointerenter event
    • pointerleave event
    • pointerlockchange event
    • pointerlockerror event
    • pointermove event
    • pointerout event
    • pointerover event
    • pointerup event
    • readystatechange event
    • scroll event
    • selectionchange event
    • touchcancel event
    • touchend event
    • touchmove event
    • touchstart event
    • transitioncancel event
    • transitionend event
    • transitionrun event
    • transitionstart event
    • visibilitychange event
    • wheel event
    • animationcancel event
    • animationend event
    • animationiteration event
    • animationstart event
    • afterscriptexecute event
    • auxclick event
    • beforescriptexecute event
    • blur event
    • click event
    • compositionend event
    • compositionstart event
    • compositionupdate event
    • contextmenu event
    • copy event
    • cut event
    • dblclick event
    • DOMActivate event
    • DOMMouseScroll event
    • error event
    • focusin event
    • focusout event
    • focus event
    • fullscreenchange event
    • fullscreenerror event
    • gesturechange event
    • gestureend event
    • gesturestart event
    • gotpointercapture event
    • keydown event
    • keypress event
    • keyup event
    • lostpointercapture event
    • mousedown event
    • mouseenter event
    • mouseleave event
    • mousemove event
    • mouseout event
    • mouseover event
    • mouseup event
    • mousewheel event
    • paste event
    • pointercancel event
    • pointerdown event
    • pointerenter event
    • pointerleave event
    • pointermove event
    • pointerout event
    • pointerover event
    • pointerup event
    • scroll event
    • select event
    • touchcancel event
    • touchend event
    • touchmove event
    • touchstart event
    • transitioncancel event
    • transitionend event
    • transitionrun event
    • transitionstart event
    • webkitmouseforcechanged event
    • webkitmouseforcedown event
    • webkitmouseforceup event
    • webkitmouseforcewillbegin event
    • wheel event
    • error event
    • message event
    • open event
    • abort event
    • error event
    • loadend event
    • loadstart event
    • load event
    • progress event
    • webglcontextcreationerror event
    • webglcontextlost event
    • webglcontextrestored event
    • toggle event
    • cancel event
    • close event
    • beforeinput event
    • change event
    • input event
    • formdata event
    • reset event
    • submit event
    • invalid event
    • search event
    • abort event
    • canplaythrough event
    • canplay event
    • durationchange event
    • emptied event
    • ended event
    • error event
    • loadeddata event
    • loadedmetadata event
    • loadstart event
    • pause event
    • playing event
    • play event
    • progress event
    • ratechange event
    • seeked event
    • seeking event
    • stalled event
    • suspend event
    • timeupdate event
    • volumechange event
    • waiting event
    • slotchange event
    • cuechange event
    • enterpictureinpicture event
    • leavepictureinpicture event
    • abort event
    • close event
    • error event
    • versionchange event
    • blocked event
    • upgradeneeded event
    • error event
    • success event
    • abort event
    • complete event
    • error event
    • devicechange event
    • error event
    • addtrack event
    • removetrack event
    • ended event
    • mute event
    • unmute event
    • change event
    • messageerror event
    • message event
    • complete event
    • merchantvalidation event
    • paymentmethodchange event
    • shippingaddresschange event
    • shippingoptionchange event
    • payerdetailchange event
    • resourcetimingbufferfull event
    • resize event
    • bufferedamountlow event
    • close event
    • closing event
    • error event
    • message event
    • open event
    • error event
    • tonechange event
    • gatheringstatechange event
    • selectedcandidatepairchange event
    • statechange event
    • addstream event
    • connectionstatechange event
    • datachannel event
    • icecandidateerror event
    • icecandidate event
    • iceconnectionstatechange event
    • icegatheringstatechange event
    • negotiationneeded event
    • removestream event
    • signalingstatechange event
    • track event
    • audioprocess event
    • message event
    • activate event
    • contentdelete event
    • install event
    • message event
    • notificationclick event
    • pushsubscriptionchange event
    • push event
    • connect event
    • audioend event
    • audiostart event
    • end event
    • error event
    • nomatch event
    • result event
    • soundend event
    • soundstart event
    • speechend event
    • speechstart event
    • start event
    • voiceschanged event
    • boundary event
    • end event
    • error event
    • mark event
    • pause event
    • resume event
    • start event
    • beginEvent event
    • endEvent event
    • repeatEvent event
    • abort event
    • error event
    • load event
    • resize event
    • scroll event
    • unload event
    • copy event
    • cut event
    • paste event
    • cuechange event
    • addtrack event
    • change event
    • removeTrack event
    • addtrack event
    • change event
    • removetrack event
    • resize event
    • scroll event
    • close event
    • error event
    • message event
    • open event
    • afterprint event
    • animationcancel event
    • animationend event
    • animationiteration event
    • animationstart event
    • appinstalled event
    • beforeprint event
    • beforeunload event
    • blur event
    • copy event
    • cut event
    • devicemotion event
    • deviceorientation event
    • DOMContentLoaded event
    • error event
    • focus event
    • gamepadconnected event
    • gamepaddisconnected event
    • hashchange event
    • languagechange event
    • load event
    • messageerror event
    • message event
    • offline event
    • online event
    • orientationchange event
    • pagehide event
    • pageshow event
    • paste event
    • popstate event
    • rejectionhandled event
    • resize event
    • storage event
    • transitioncancel event
    • transitionend event
    • transitionrun event
    • transitionstart event
    • unhandledrejection event
    • unload event
    • vrdisplayactivate event
    • vrdisplayblur event
    • vrdisplayconnect event
    • vrdisplaydeactivate event
    • vrdisplaydisconnect event
    • vrdisplayfocus event
    • vrdisplaypointerrestricted event
    • vrdisplaypointerunrestricted event
    • vrdisplaypresentchange event
    • messageerror event
    • message event
    • languagechange event
    • abort event
    • error event
    • loadend event
    • loadstart event
    • load event
    • progress event
    • timeout event
    • reset event
    • end event
    • inputsourceschange event
    • selectend event
    • selectstart event
    • select event
    • squeezeend event
    • squeezestart event
    • squeeze event
    • visibilitychange event
    • devicechange event

    Specifications

    Found a content problem with this page?

    This page was last modified on Jul 19, 2023 by MDN contributors.

    Источник

Оцените статью