Input URL autofocusProperty
Example
Check if a URL field automatically gets focus after the page loads:
var x = document.getElementById("myURL").autofocus;
xThe result is:true
Try it yourself »
Definition and Usage
The autofocus property is used to set or return whether the URL field automatically gets focus after the page loads.
This property reflects the HTML autofocus attribute.
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the autofocus property.
Note:Internet Explorer 9 and earlier versions of IE, or Opera 12 and earlier versions of Opera, do not support the autofocus property.
Note:Internet Explorer or Safari browsers do not support HTML <input> elements with type="url".
Syntax
Return the autofocus property:
urlObject.autofocus
Set the autofocus property:
urlObject.autofocus=true|false
Property Values
| Value | Description |
|---|---|
| true|false | Describes whether the URL field gets focus after the page loads.
|
Technical Details
| Return Value: | A Boolean, returns true if the URL field automatically gets focus after the page loads, otherwise returns false. |
|---|
Related Pages
HTML Reference:HTML <input> autofocus Attribute
Input URL Object Other Extensions