// 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.");
};Node: selectstart event / notebook
Node: selectstart event
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.