Properti Indeks tab DOM HTML
Contoh
Ubah urutan tab untuk tiga tautan:
document.getElementById("myAnchor1").tabIndex = "3";
document.getElementById("myAnchor2").tabIndex = "2";
document.getElementById("myAnchor3").tabIndex = "1";
Lebih banyak contoh "Coba Sendiri" di bawah ini.
Definisi dan Penggunaan
Properti tabIndex menetapkan atau mengembalikan nilai atribut tabindex dari suatu elemen.
Atribut tabindex menentukan urutan tab suatu elemen (ketika tombol "tab" digunakan untuk menavigasi).
Dukungan Peramban
Property | |||||
---|---|---|---|---|---|
tabIndex | Yes | Yes | Yes | Yes | Yes |
Sintaksis
Kembalikan properti tabIndex:
HTMLElementObject.tabIndex
Setel properti tabIndex:
HTMLElementObject.tabIndex = number
Nilai properti
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 |
Detail Teknis
Nilai Kembali: | Angka, mewakili urutan tab elemen |
---|
Lebih Banyak Contoh
Contoh
Dapatkan urutan tab elemen <a> pertama (indeks 0) dalam dokumen:
var x = document.getElementsByTagName("A")[0].tabIndex;
document.getElementById("demo").innerHTML = x;
Halaman Terkait
Referensi HTML: Atribut tabindex HTML
Objek Elemen