DOM Event Interface
The Event interface represents something that happened in the page, such as a click or key press. Every event listener receives an Event object describing it.
Description
The Event interface represents an event that takes place in the DOM, whether caused by the user (a click), the browser (a page load) or your code (dispatchEvent()). Each listener receives an Event object, or one of its many subtypes such as MouseEvent, KeyboardEvent and InputEvent, with details about what happened.
Most events travel in three phases: capture down from the window to the target, the target itself, then bubbling back up through its ancestors. That's what lets one listener on a parent handle events from many children. Common members include type, target, currentTarget, preventDefault() and stopPropagation().
You can create and dispatch events yourself with new Event(type, options), or new CustomEvent() to include data. isTrusted tells you whether an event came from the user or the browser rather than from a script. Not every event bubbles or can be cancelled; the bubbles and cancelable properties report that, and the composed property says whether it crosses shadow DOM boundaries.
Properties
| Name | Description |
|---|---|
Event.currentTarget | The currentTarget property of an event is the element that the running event listener is attached to. |
Event.target | The target property of an event is the element where the event originally happened, such as the exact element that was clicked. |
Event.type | The type property of an event gives its name, such as click, input or keydown. |
Methods
| Name | Description |
|---|---|
Event.preventDefault() | The preventDefault() method stops the browser's default action for an event, such as following a link or submitting a form. |
Event.stopPropagation() | The stopPropagation() method stops an event from travelling further up (or down) the DOM tree, so listeners on parent elements don't receive it. |
Example
Browser Support
The following information will show you the current browser support for the Event interface. Hover over a browser icon to see the version that first introduced support for this interface.
Desktop





Tablets & Mobile





