Input Email autofocus attribute
Definition and usage
autofocus
Property setting or returning whether the email field should automatically receive focus when the page is loaded.
This property reflects the HTML autofocus attribute.
See also:
HTML Reference Manual:Proprietà autofocus di <input> HTML
Example
Determine whether the email field automatically receives focus when the page is loaded:
var x = document.getElementById("myEmail").autofocus;
Syntax
Return the autofocus attribute:
emailObject.autofocus
Set the autofocus attribute:
emailObject.autofocus = "true|false"
Attribute value
Value | Description |
---|---|
true|false |
Specifies whether the email field should receive focus when the page is loaded
|
Technical details
Return value: | Boolean value, returned if the email field automatically receives focus when the page is loaded true ;otherwise return false 。 |
---|
Browser support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Supporta | Supporta | Supporta | Supporta | Supporta |
Tutti i principali browser supportano autofocus
Proprietà.
Nota:Internet Explorer 9 e versioni precedenti o Opera 12 e versioni precedenti non supportano autofocus
Proprietà.
Nota:Internet Explorer 9 e versioni precedenti o Safari non supportano l'elemento <input type="email">.