Easy Tutorial
❮ Met Canvas Measuretext Prop Hidden Form ❯

Input Email autofocus Attribute

Input Email Object

Example

Check if the email field automatically gains focus when the page loads:

var x = document.getElementById("myEmail").autofocus;
true

Definition and Usage

The autofocus attribute is used to set or return whether the email field should automatically gain focus when the page loads.

This attribute reflects the HTML autofocus attribute.


Browser Support

All major browsers support the autofocus attribute.

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

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


Syntax

Return the autofocus attribute:

Set the autofocus attribute:

Attribute Values

Value Description
true false Describes whether the email field gains focus on page load. <br> true - The email field gains focus. <br> false - Default. The email field does not gain focus.

Technical Details

| Return Value: | Boolean, returns true if the email field automatically gains focus on page load, otherwise returns false. | | --- | --- |


Related Pages

HTML Reference: HTML <input> autofocus Attribute


❮ Met Canvas Measuretext Prop Hidden Form ❯