selectionchange

The selectionchange event of the Selection API is fired when the selection object of the document is modified. The selectionchange event is fired at the document.

Bubbles No
Cancelable No
Target objects Document, HTMLInputElement, HTMLTextAreaElement
Interface Event

Example

document.addEventListener("selectionchange", function(e) {
  console.log(e); 
}, false);


// "selectionchange" event is logged when a selection start on the page.

Inheritance

The selectionchange event implements the Event interface. You can use the properties and methods defined on this interface.

Specifications

Specification Status Comment
Selection API
The definition of 'selectionchange' in that specification.
Working Draft Initial definition.

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support (Yes) 52 (52) (Yes) (Yes) ?
on HTMLInputElement and HTMLTextAreaElement No support 52 (52) - [1] No support No support No support
Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support (Yes) (Yes) 52.0 (52) (Yes) (Yes) ?
on HTMLInputElement and HTMLTextAreaElement No support No support 52.0 (52) - [1] No support No support No support

[1] - Experimental support in Nightly behind the dom.select_events.textcontrols.enabled preference. Support for input and textarea is currently not part of the specification.

See also

Document Tags and Contributors

 Contributors to this page: Ehsan, spencer-brown, Nickolay, teoli
 Last updated by: Ehsan,