Propiedad HTML DOM tabIndex
Ejemplo
Cambie el orden de tabulación de tres enlaces:
document.getElementById("myAnchor1").tabIndex = "3";
document.getElementById("myAnchor2").tabIndex = "2";
document.getElementById("myAnchor3").tabIndex = "1";
Más ejemplos de "Pruébelo usted mismo" a continuación.
Definición y uso
La propiedad tabIndex establece o devuelve el valor del atributo tabindex de un elemento.
El atributo tabindex especifica el orden de tabulación de un elemento (cuando el botón "tab" se usa para navegar).
Compatibilidad con navegador
Property | |||||
---|---|---|---|---|---|
tabIndex | Yes | Yes | Yes | Yes | Yes |
Sintaxis
Devuelve la propiedad tabIndex:
HTMLElementObject.tabIndex
Establezca la propiedad tabIndex:
HTMLElementObject.tabIndex = number
Valores de propiedad
Value | Description |
---|---|
number | Specifies the tabbing order of the element (1 is first). Note: If the number is negative, the element will be removed from the tab order |
Detalles técnicos
Valor de retorno: | Un número, que representa el orden de tabulación del elemento. |
---|
Más ejemplos
Ejemplo
Obtenga el orden de tabulación del primer elemento <a> (índice 0) en el documento:
var x = document.getElementsByTagName("A")[0].tabIndex;
document.getElementById("demo").innerHTML = x;
páginas relacionadas
Referencia HTML: Atributo HTML tabindex
❮ Objeto Elemento