removeRange
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since septiembre de 2023.
Resumen
Quita un rango de la selección.
Sintaxis
sel.removeRange( range)
Parámetros
range-
Un objeto rango que será eliminado de la selección.
Ejemplos
/* Programadamente, mas de un rango puede ser seleccionado.
* Esto eliminará todos los rangos excepto el primero. */
s = window.getSelection();
if(s.rangeCount > 1) {
for(var i = 1; i < s.rangeCount; i++) {
s.removeRange(s.getRangeAt(i));
}
}