Select autofocus attribute
Definition and usage
autofocus
Attribute settings or returns whether the dropdown list should automatically have focus when the page is loaded.
This attribute reflects HTML autofocus attribute.
See also:
Panduan Referensi HTML:Tanda <select> HTML
Example
Check if the dropdown list will automatically have focus when the page is loaded:
var x = document.getElementById("mySelect").autofocus;
Syntax
Return autofocus attribute:
selectObject.autofocus
Set autofocus attribute:
selectObject.autofocus = true|false
Attribute value
Value | Description |
---|---|
true|false |
Specify whether the dropdown list should have focus when the page is loaded.
|
Detil Teknis
Nilai yang kembali: | Nilai boolean, jika daftar pilihan otomatis mendapatkan fokus saat halaman dimuat, kembalikan true; jika tidak, kembalikan false. |
---|
Dukungan Browser
Angka di tabel menunjukkan versi browser yang mendukung properti ini penuh.
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Dukungan | 10.0 | Dukungan | Dukungan | Dukungan |
Halaman yang berhubungan
Panduan Referensi HTML:Atribut autofocus <select> HTML