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.
Bubbles | Yes |
---|---|
Cancelable | Yes |
Interface | Event |
Event handler property | onselectstart |
Examples
// addEventListener version
document.addEventListener('selectstart', () => {
console.log('Selection started');
});
// onselectstart version
document.onselectstart = () => {
console.log('Selection changed.');
};
Specifications
Specification | Status | Comment |
---|---|---|
Selection API The definition of 'selectstart' in that specification. |
Working Draft | Initial definition. |
Browser compatibility
BCD tables only load in the browser