Input Date autofocusProperty
Examples
Check whether the date field automatically gets focus after the page loads:
var x = document.getElementById("myDate").autofocus;
xThe output result is:true
Try it yourself »
Definition and Usage
The autofocus property is used to set or return whether the date field automatically gets focus after the page loads.
This property reflects the HTML autofocus attribute.
Browser Support
![]()
![]()
![]()
![]()
![]()
The autofocus property is supported by all major browsers.
Note:Internet Explorer 9 and earlier IE versions, Opera 12 and earlier Opera versions do not support this property.
Note:Internet Explorer or Firefox browsers do not support the <input type="date"> element.
Syntax
Return the autofocus property:
inputdateObject.autofocus
Set the autofocus property:
inputdateObject.autofocus=true|false
Property Values
| Value | Description |
|---|---|
| true|false | Describes whether the date field gets focus after the page loads
|
Technical Details
| Return value: | A Boolean value, returns true if the date field automatically gets focus after the page loads, otherwise returns false. |
|---|
Related Pages
HTML Reference Manual:HTML <input> autofocus Attribute
Input Date Object Other Extensions