Selection.removeAllRanges()

Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The Selection.removeAllRanges() method removes all ranges from the selection, leaving the anchorNode and focusNode properties equal to null and leaving nothing selected.

Syntax

sel.removeAllRanges();

Parameters

None.

Specifications

Specification
Selection API
# dom-selection-removeallranges

Browser compatibility

BCD tables only load in the browser

See also