Input URL autofocus Attribute
Example
Check if the URL field automatically gains focus after the page loads:
Definition and Usage
The autofocus attribute is used to set or return whether the URL field automatically gains 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 or Opera 12 and earlier versions do not support the autofocus attribute.
Note: Internet Explorer or Safari browsers do not support the HTML <input> element with the type="url" attribute.
Syntax
Return the autofocus attribute:
Set the autofocus attribute:
Attribute Values
| Value | Description | |
|---|---|---|
| true | false | Describes whether the URL field gains focus after the page loads. <br> true - The URL field gains focus. <br> false - Default. The URL field does not gain focus. |
Technical Details
| Return Value: | Boolean, returns true if the URL field automatically gains focus after the page loads, otherwise returns false. | | --- | --- |
Related Pages
HTML Reference: HTML <input> autofocus Attribute