Favorites

DOM Event Interface

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
Event
DOM InterfaceThis interface is supported by all modern browsers.
Updated 28th November 2026

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

NameDescription
Event.currentTargetThe currentTarget property of an event is the element that the running event listener is attached to.
Event.targetThe target property of an event is the element where the event originally happened, such as the exact element that was clicked.
Event.typeThe type property of an event gives its name, such as click, input or keydown.

Methods

NameDescription
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

<ul id="menu">
  <li>Home</li>
  <li>About</li>
</ul>
const list = document.getElementById('menu');
list.addEventListener('click', event => {
  console.log(event.type, 'on', event.target.textContent);
  console.log('listener is on', event.currentTarget.id);
  console.log('bubbles:', event.bubbles);
});
list.querySelector('li').click();

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.

This interface is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee