Input Password autofocus Attribute
Definition and Usage
autofocus
Attribute setting or returning whether the password field should be automatically focused when the page is loaded.
This property reflects the HTML autofocus attribute.
See also:
HTML Reference Manual:Attribut autofocus de l'élément <input> HTML
Example
Check if the password field is automatically focused when the page is loaded:
var x = document.getElementById("myPassword").autofocus;
Syntax
Return the autofocus attribute:
passwordObject.autofocus
Set the autofocus attribute:
passwordObject.autofocus = true|false
attribute value
value | description |
---|---|
true|false |
规定在页面加载时密码字段是否应该获得焦点。
|
false - par défaut. Le champ de mot de passe n'a pas le focus
Détails techniques | Valeur de retour : true ;sinon retourne false . |
---|
Compatibilité avec les navigateurs
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | 10.0 | Support | Support | Support |