Latest web development tutorials

HTML DOM Input Email autofocus attribute

Input Email Object Reference Input Email Object

Examples

See if the email field automatically get the focus when the page is loaded:

var x = document.getElementById ( "myEmail") autofocus.;
x The output is:
true

try it"

Definition and Usage

autofocus property sets or returns the email field is automatically get the focus when the page loads.

This property reflects the HTML autofocus property.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the autofocus attribute.

Note: Internet Explorer 9 and earlier versions of IE, Opera 12 and earlier version of Opera browser does not support this property.

Note: Internet Explorer 9 (and earlier versions of IE), or Safari browser does not support type = "email" in the HTML <input> elements.


grammar

Back autofocus properties:

emailObject .autofocus

Setting autofocus properties:

emailObject .autofocus = true | false

Property Value

value description
true | false It describes the email field if gets focus after the page loads
  • true - email field gets focus
  • false - default. email field does not get the focus.

technical details

return value: Boolean value that, if the page email field automatically get focus after loading returns true, otherwise returns false.


Related Pages

HTML Reference Manual: HTML <the INPUT> The autofocus attribute


Input Email Object Reference Input Email Object