Node: selectstart event


目录

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 addEventListener():

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

Alternatively, assign to the event handler property of the interface:

onselectstart = (event) => { }

Event type

A generic Event.

Examples

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

// onselectstart version (but note that this replaces other event listeners
// added using onselectstart, if any)
document.onselectstart = () => {
  console.log("Selection started.");
};

Specifications

Browser compatibility

See also


版本号 #3
由 壳壳虫 创建于 2026-10-31 03:27:53 UTC
由 cocobook-sync 更新于 2026-11-04 17:34:51 UTC