Proprietà HTML DOM tabIndex
Esempio
Modificare l'ordine di tabulazione per tre collegamenti:
document.getElementById("myAnchor1").tabIndex = "3";
document.getElementById("myAnchor2").tabIndex = "2";
document.getElementById("myAnchor3").tabIndex = "1";
Altri esempi "Provalo da solo" di seguito.
Definizione e utilizzo
La proprietà tabIndex imposta o restituisce il valore dell'attributo tabindex di un elemento.
L'attributo tabindex specifica l'ordine di tabulazione di un elemento (quando si utilizza il pulsante "tab" per la navigazione).
Supporto browser
Property | |||||
---|---|---|---|---|---|
tabIndex | Yes | Yes | Yes | Yes | Yes |
Sintassi
Restituisce la proprietà tabIndex:
HTMLElementObject.tabIndex
Imposta la proprietà tabIndex:
HTMLElementObject.tabIndex = number
Valori di proprietà
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 |
Dettagli tecnici
Valore di ritorno: | Un numero, che rappresenta l'ordine di tabulazione dell'elemento |
---|
Altri esempi
Esempio
Ottieni l'ordine di tabulazione del primo elemento <a> (indice 0) nel documento:
var x = document.getElementsByTagName("A")[0].tabIndex;
document.getElementById("demo").innerHTML = x;
Pagine correlate
Riferimento HTML: attributo HTML tabindex
❮ Oggetto Elemento