removeAllRanges

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

MDN Reference