EventTarget
Baseline Widely available *
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
* Some parts of this feature may have varying levels of support.
Note: This feature is available inWeb Workers.
TheEventTarget interface is implemented by objects that can receive events and may have listeners for them.In other words, any target of events implements the three methods associated with this interface.
Element, and its children, as well asDocument andWindow, are the most common event targets,but other objects can be event targets, too.For exampleIDBRequest,AudioNode, andAudioContext are also event targets.
Many event targets (including elements, documents, and windows) also supportregistering event handlers viaonevent properties and attributes.
In this article
Constructor
EventTarget()Creates a new
EventTargetobject instance.
Instance methods
EventTarget.addEventListener()Registers an event handler of a specific event type on the
EventTarget.EventTarget.removeEventListener()Removes an event listener from the
EventTarget.EventTarget.dispatchEvent()Dispatches an event to this
EventTarget.
Specifications
| Specification |
|---|
| DOM> # interface-eventtarget> |
Browser compatibility
See also
- Event index
- Introduction to events
Eventinterface