Events

Оновлено: 09.03.2023

HTML DOM Events

DOM Events allow JavaScript to add event listener or event handlers to HTML elements.

EventOccurs WhenBelongs To
abortThe loading of a media is abortedUiEvent, Event
afterprintA page has started printingEvent
animationendA CSS animation has completedAnimationEvent
animationiterationA CSS animation is repeatedAnimationEvent
animationstartA CSS animation has startedAnimationEvent
beforeprintA page is about to be printedEvent
beforeunloadBefore a document is about to be unloadedUiEvent, Event
blurAn element loses focusFocusEvent
canplayThe browser can start playing a media (has buffered enough to begin)Event
canplaythroughThe browser can play through a media without stopping for bufferingEvent
changeThe content of a form element has changedEvent
clickAn element is clicked onMouseEvent
contextmenuAn element is right-clicked to open a context menuMouseEvent
copyThe content of an element is copiedClipboardEvent
cutThe content of an element is cuttedClipboardEvent
dblclickAn element is double-clickedMouseEvent
dragAn element is being draggedDragEvent
dragendDragging of an element has endedDragEvent
dragenterA dragged element enters the drop targetDragEvent
dragleaveA dragged element leaves the drop targetDragEvent
dragoverA dragged element is over the drop targetDragEvent
dragstartDragging of an element has startedDragEvent
dropA dragged element is dropped on the targetDragEvent
durationchangeThe duration of a media is changedEvent
endedA media has reach the end ("thanks for listening")Event
errorAn error has occurred while loading a fileProgressEvent, UiEvent, Event
focusAn element gets focusFocusEvent
focusinAn element is about to get focusFocusEvent
focusoutAn element is about to lose focusFocusEvent
fullscreenchangeAn element is displayed in fullscreen modeEvent
fullscreenerrorAn element can not be displayed in fullscreen modeEvent
hashchangeThere has been changes to the anchor part of a URLHashChangeEvent
inputAn element gets user inputInputEvent, Event
invalidAn element is invalidEvent
keydownA key is downKeyboardEvent
keypressA key is pressedKeyboardEvent
keyupA key is releasedKeyboardEvent
loadAn object has loadedUiEvent, Event
loadeddataMedia data is loadedEvent
loadedmetadataMeta data (like dimensions and duration) are loadedEvent
loadstartThe browser starts looking for the specified mediaProgressEvent
messageA message is received through the event sourceEvent
mousedownThe mouse button is pressed over an elementMouseEvent
mouseenterThe pointer is moved onto an elementMouseEvent
mouseleaveThe pointer is moved out of an elementMouseEvent
mousemoveThe pointer is moved over an elementMouseEvent
mouseoverThe pointer is moved onto an elementMouseEvent
mouseoutThe pointer is moved out of an elementMouseEvent
mouseupA user releases a mouse button over an elementMouseEvent
mousewheelDeprecated. Use the wheel event insteadWheelEvent
offlineThe browser starts working offlineEvent
onlineThe browser starts working onlineEvent
openA connection with the event source is openedEvent
pagehideUser navigates away from a webpagePageTransitionEvent
pageshowUser navigates to a webpagePageTransitionEvent
pasteSome content is pasted in an elementClipboardEvent
pauseA media is pausedEvent
playThe media has started or is no longer pausedEvent
playingThe media is playing after beeing paused or bufferedEvent
popstateThe window's history changesPopStateEvent
progressThe browser is downloading media dataEvent
ratechangeThe playing speed of a media is changedEvent
resizeThe document view is resizedUiEvent, Event
resetA form is resetEvent
scrollAn scrollbar is being scrolledUiEvent, Event
searchSomething is written in a search fieldEvent
seekedSkipping to a media position is finishedEvent
seekingSkipping to a media position is startedEvent
selectUser selects some textUiEvent, Event
showA menu element is shown as a context menuEvent
stalledThe browser is trying to get unavailable media dataEvent
storageA Web Storage area is updatedStorageEvent
submitA form is submittedEvent
suspendThe browser is intentionally not getting media dataEvent
timeupdateThe playing position has changed (the user moves to a different point in the media)Event
toggleThe user opens or closes the details elementEvent
touchcancelThe touch is interruptedTouchEvent
touchendA finger is removed from a touch screenTouchEvent
touchmoveA finger is dragged across the screenTouchEvent
touchstartA finger is placed on a touch screenTouchEvent
transitionendA CSS transition has completedTransitionEvent
unloadA page has unloadedUiEvent, Event
volumechangeThe volume of a media is changed (includes muting)Event
waitingA media is paused but is expected to resume (e.g. buffering)Event
wheelThe mouse wheel rolls up or down over an elementWheelEvent