Input Password autofocus Attribute
Definition and Usage
autofocus
Attribute to set or return whether the password field should automatically get focus when the page is loaded.
This attribute reflects the HTML autofocus attribute.
See also:
HTML Reference Manual:HTML <input> autofocus Attribute
Example
Check if the password field automatically gets focus when the page is loaded:
var x = document.getElementById("myPassword").autofocus;
Syntax
Return autofocus attribute:
passwordObject.autofocus
Set autofocus attribute:
passwordObject.autofocus = true|false
attribute value
value | description |
---|---|
true|false |
Specifies whether the password field should gain focus when the page is loaded
|
Technical Details
Return value: | Boolean value, returned if the password field automatically gains focus when the page is loaded true ; otherwise return false |
---|
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | 10.0 | Support | Support | Support |