Events

This section is non-normative.
List of events
Event Interface Interesting targets Description
abort {{Event}} {{Window}} Fired at the {{Window}} when the download was aborted by the user
DOMContentLoaded {{Event}} {{Document}} Fired at the {{Document}} once the parser has finished
afterprint {{Event}} {{Window}} Fired at the {{Window}} after printing
afterscriptexecute {{Event}} <{script}> elements Fired at <{script}> elements after the script runs (just before the corresponding load event)
beforeprint {{Event}} {{Window}} Fired at the {{Window}} before printing
beforescriptexecute {{Event}} <{script}> elements Fired at <{script}> elements just before the script runs; canceling the event cancels the running of the script
beforeunload {{BeforeUnloadEvent}} {{Window}} Fired at the {{Window}} when the page is about to be unloaded, in case the page would like to show a warning prompt
blur {{Event}} {{Window}}, elements Fired at nodes losing focus
cancel {{Event}} <{dialog}> elements Fired at <{dialog}> elements when they are canceled by the user (e.g., by pressing the Escape key)
change {{Event}} Form controls Fired at controls when the user commits a value change (see also the input event)
click {{MouseEvent}} Elements Normally a mouse event; also synthetically fired at an element before its activation behavior is run, when an element is activated from a non-pointer input device (e.g., a keyboard)
close {{Event}} <{dialog}> elements, WebSocket Fired at dialog elements when they are closed, and at WebSocket elements when the connection is terminated
copy {{Event}} Elements Fired at elements when the user copies data to the clipboard
cut {{Event}} Elements Fired at elements when the user copies the selected data on the clipboard and removes the selection from the document
error {{Event}} Global scope objects, {{Worker}} objects, elements, networking-related objects Fired when unexpected errors occur (e.g., networking errors, script errors, decoding errors)
focus {{Event}} {{Window}}, elements Fired at nodes gaining focus
focusin {{Event}} {{Window}}, elements Fired at nodes gaining focus
focusout {{Event}} {{Window}}, elements Fired at nodes losing focus
hashchange {{HashChangeEvent}} {{Window}} Fired at the {{Window}} when the fragment part of the document's [=Document/URL=] changes
input {{Event}} Form controls Fired at controls when the user changes the value (see also the change event)
invalid {{Event}} Form controls Fired at controls during form validation if they do not satisfy their constraints
languagechange {{Event}} Global scope objects Fired at the global scope object when the user's preferred languages change
load {{Event}} {{Window}}, elements Fired at the {{Window}} when the document has finished loading; fired at an element containing a resource (e.g., <{img}>, <{embed}>) when its resource has finished loading
loadend {{Event}} or {{ProgressEvent}} <{img}> elements Fired at <{img}> elements after a successful load (see also media element events)
loadstart {{ProgressEvent}} <{img}> elements Fired at <{img}> elements when a load begins (see also media element events)
message MessageEvent {{Window}}, EventSource, WebSocket, MessagePort, BroadcastChannel, DedicatedWorkerGlobalScope, {{Worker}} Fired at an object when it receives a message
offline {{Event}} Global scope objects Fired at the global scope object when the network connections fails
online {{Event}} Global scope objects Fired at the global scope object when the network connections returns
open {{Event}} EventSource, WebSocket Fired at networking-related objects when a connection is established
pagehide {{PageTransitionEvent}} {{Window}} Fired at the {{Window}} when the page's entry in the session history stops being the current entry
pageshow {{PageTransitionEvent}} {{Window}} Fired at the {{Window}} when the page's entry in the session history becomes the current entry
paste {{Event}} Elements Fired at elements when the user will insert the clipboard data in the most suitable format (if any) supported for the given context
popstate {{PopStateEvent}} {{Window}} Fired at the {{Window}} when the user navigates the session history
progress {{ProgressEvent}} <{img}> elements Fired at <{img}> elements during a CORS-same-origin image load (see also media element events)
{{global/readystatechange}} {{Event}} {{Document}} Fired at the {{Document}} when it finishes parsing and again when all its subresources have finished loading
reset {{Event}} <{form}> elements Fired at a <{form}> element when it is reset
select {{Event}} Form controls Fired at form controls when their text selection is adjusted (whether by an API or by the user)
storage StorageEvent {{Window}} Fired at {{Window}} event when the corresponding localStorage or sessionStorage storage areas change
submit {{Event}} <{form}> elements Fired at a <{form}> element when it is submitted
toggle {{Event}} <{details}> element Fired at <{details}> elements when they open or close
unload {{Event}} {{Window}} Fired at the {{Window}} object when the page is going away

See also media element events and drag-and-drop events.