1. Tecnología web para desarrolladores
  2. API web
  3. Selection
  4. removeRange

Esta página ha sido traducida del inglés por la comunidad. Aprende más y únete a la comunidad de MDN Web Docs.

View in English Always switch to English

removeRange

Baseline 2023
Newly available

Since ⁨September 2023⁩, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.

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));
 }
}

Help improve MDN

Learn how to contribute

This page was last modified on by MDN contributors.

AltStyle によって変換されたページ (->オリジナル) /