Firefox Tomorrow

web api event

Node: selectstart event

View on MDN ↗

The selectstart event of the Selection API is fired when a user starts a new selection.

If the event is canceled, the selection is not changed.

Syntax

Use the event name in methods like addEventListener(), or set an event handler property.

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

onselectstart = (event) => { }

Event type

A generic Event.

Examples

// addEventListener version
document.addEventListener("selectstart", () => {
  console.log("Selection started");
});

// onselectstart version
document.onselectstart = () => {
  console.log("Selection started.");
};

Specifications

SpecificationsStandards references are available on the canonical MDN page.

Browser compatibility

Browser compatibilityCompatibility data is available on the canonical MDN page.

See also