Firefox Tomorrow

web api event

Element: DOMActivate event

View on MDN ↗

The DOMActivate event is fired at an element when it becomes active, such as when it is clicked on using the mouse or a keypress is used to navigate to it.

Syntax

Use the event name in methods like addEventListener().

addEventListener("DOMActivate", (event) => { })

[!NOTE] There is no onDOMActivate event handler property for this event.

Event type

A UIEvent. Inherits from Event.

Examples

This example listens for DOMActivate on a <button> element and displays its detail.

HTML

<button>Click</button>

JavaScript

const button = document.querySelector("button");

button.addEventListener("DOMActivate", (event) => {
  button.textContent = `Click count: ${event.detail}`;
});

Result

Note that detail of the DOMActivate event may have browser-specific behavior. It may either always be 0, or have similar behavior as the click event’s detail (i.e., indicating the number of consecutive clicks).

Interactive exampleOpen the canonical MDN source to run this embedded demo.

Specifications

SpecificationsStandards references are available on the canonical MDN page.

Browser compatibility

Browser compatibilityCompatibility data is available on the canonical MDN page.

See also