---
title: Selection.removeAllRanges()
slug: Web/API/Selection/removeAllRanges
tags:
  - API
  - Experimental
  - HTML Editing
  - Method
  - Reference
  - Selection
browser-compat: api.Selection.removeAllRanges
---
{{ ApiRef("DOM") }}{{SeeCompatTable}}

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

## Syntax

```js
sel.removeAllRanges();
```

### Parameters

_None._

## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}

## See also

- {{domxref("Selection")}}, the interface it belongs to.
