Baseline 2023
Newly available
The Selection.removeRange()
method removes a range from a selection.
range
A range object that will be removed from the selection.
None (undefined
).
/* Programmatically, more than one range can be selected.
* This will remove all ranges except the first. */
const s = window.getSelection();
if (s.rangeCount > 1) {
for (let i = 1; i < s.rangeCount; i++) {
s.removeRange(s.getRangeAt(i));
}
}
Specifications Browser compatibility See also
Selection
, the interface it belongs to.RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4