The Event Object

❮ DOM Events ❮ Event Objects

All event objects in the HTML DOM are based on the Event Object.

All event objects (like MouseEvent and KeyboardEvent) has access to the Event Object's properties and methods.

Event Object Events

Event Occurs When
abort The loading of a media is aborted
afterprint A page has started printing
beforeprint A page is about to be printed
beforeunload Before the document is about to be unloaded
canplay The browser can start playing a media (has buffered enough to begin)
canplaythrough The browser can play through a media without stopping for buffering
change The content of a form element have changed
ended A media has reach the end ("thanks for listening")
error An error has occurred while loading a file
fullscreenchange An element is displayed in fullscreen mode
fullscreenerror An element can not be displayed in fullscreen mode
input An element gets user input
invalid An element is invalid
load An object has loaded
loadeddata Media data is loaded
loadedmetadata Meta data (like dimensions and duration) are loaded
message A message is received through the event source
offline The browser starts working offline
online the browser starts working online
open A connection with the event source is opened
pause A media is paused
play A media has started or is no longer paused
playing A media is playing after beeing paused or buffered
progress The browser is downloading media data
ratechange The playing speed of a media is changed
resize The document view is resized
reset A form is reset
scroll A scrollbar is being scrolled
search Something is written in a search field
seeked Skipping to a new position is finished
seeking Skipping to a new position is started
select A user selects some text
show A <menu> element is shown as a context menu
stalled The browser is trying to get unavailable media data
submit A form is submitted
suspend The browser is intentionally not getting media data
timeupdate The playing position has changed (the user moves to a different point in the media)
toggle The user opens or closes a <details> element
unload A page has unloaded
waiting A media is paused but is expected to resume (e.g. buffering)
volumechange The volume of a media is changed (includes muting)

All event objects in the HTML DOM are based on the Event Object.

All event objects (like MouseEvent and KeyboardEvent) has access to the Event Object's properties and methods.

Event Properties and Methods

Property/Method Description
bubbles Returns whether or not a specific event is a bubbling event
cancelBubble Sets or returns whether the event should propagate up the hierarchy or not
cancelable Returns whether or not an event can have its default action prevented
composed Returns whether the event is composed or not
createEvent() Creates a new event
composedPath() Returns the event's path
currentTarget Returns the element whose event listeners triggered the event
defaultPrevented Returns whether or not the preventDefault() method was called for the event
eventPhase Returns which phase of the event flow is currently being evaluated
isTrusted Returns whether or not an event is trusted
preventDefault() Cancels the event if it is cancelable, meaning that the default action that belongs to the event will not occur
stopImmediatePropagation() Prevents other listeners of the same event from being called
stopPropagation() Prevents further propagation of an event during event flow
target Returns the element that triggered the event
timeStamp Returns the time (in milliseconds relative to the epoch) at which the event was created
type Returns the name of the event

❮ DOM Events ❮ Event Objects

Copyright 1999-2023 by Refsnes Data. All Rights Reserved.