Input Email autofocusProperty

Input Email 对象参考手册Input Email Object

Examples

Check whether the email field automatically gets focus after the page loads:

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

Try it yourself »

Definition and Usage

The autofocus property is used to set or return whether the email field automatically gets focus after the page loads.

This property reflects the HTML autofocus attribute.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the autofocus property.

Note:Internet Explorer 9 and earlier IE versions, Opera 12 and earlier Opera versions do not support this property.

Note:Internet Explorer 9 (and earlier IE versions), or Safari browsers do not support HTML <input> elements with type="email".


Syntax

Return the autofocus property:

emailObject.autofocus

Set the autofocus property:

emailObject.autofocus=true|false

Property Values

Value Description
true|false Describes whether the email field gets focus after the page loads
  • true - The email field gets focus
  • false - Default. The email field does not get focus.

Technical Details

Return value: A Boolean value, returns true if the email field automatically gets focus after the page loads, otherwise returns false.


Related Pages

HTML Reference Manual:HTML <input> autofocus Attribute


Input Email 对象参考手册Input Email Object Other Extensions