Deselect everything that is selected
suggest changeThis is browser-only. removeAllRanges() clears the current selection. getSelection() can return null when there is no selection object.
const sel = document.getSelection();
if (sel) {
sel.removeAllRanges();
}
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents