autofocus
Attribute for Input Date
Example
Check if the date field automatically gains focus after the page loads:
Definition and Usage
The autofocus
attribute is used to set or return whether the date field should automatically gain focus when the page loads.
This attribute reflects the HTML autofocus
attribute.
Browser Support
The autofocus
property is supported by all major browsers.
Note: Internet Explorer 9 and earlier versions, and Opera 12 and earlier versions do not support this property.
Note: Internet Explorer and Firefox do not support the <input type="date">
element.
Syntax
Return the autofocus
attribute:
Set the autofocus
attribute:
Attribute Values
Value | Description | |
---|---|---|
true | false | Specifies whether the date field should gain focus when the page loads. true - The date field gains focus. <br> false - Default. The date field does not gain focus. |
Technical Details
| Return Value: | Boolean, returns true if the date field automatically gains focus when the page loads, otherwise returns false. | | --- | --- |
Related Pages
HTML Reference: HTML <input> autofocus Attribute