Input Button autofocus Attribute
Definition and Usage
autofocus
Set or return whether the input button should automatically gain focus when the page is loaded.
This attribute reflects the HTML autofocus attribute.
See also:
HTML Reference Manual:Attribut autofocus de l'élément <input> HTML
Example
Check if the button automatically gains focus when the page is loaded:
var x = document.getElementById("myBtn").autofocus;
Syntax
Return the autofocus attribute:
buttonObject.autofocus
Set the autofocus attribute:
buttonObject.autofocus = true|false
attribute value
value | description |
---|---|
true|false |
Définit si le bouton d'entrée doit obtenir le focus lors du chargement de la page.
|
Détails techniques
Valeur de retour : | Valeur booléenne, retourne si le bouton d'entrée obtient automatiquement le focus lors du chargement de la page true , sinon retourne false . |
---|
Compatibilité des navigateurs
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support |