YouTip LogoYouTip

Prop Url Autofocus

# Input URL autofocus Property [![Image 8: Input URL Object Reference](#) Input URL Object](#) ## Example Check if the URL field automatically gets focus after page load: ```javascript var x = document.getElementById("myURL").autofocus; The output of _x_ will be: true [Try it Yourself Β»](#) * * * ## Definition and Usage The autofocus property sets or returns whether a URL field should automatically get focus when the page loads. This property reflects the HTML autofocus attribute. * * * ## Browser Support ![Image 9: Internet Explorer](#)![Image 10: Firefox](#)![Image 11: Opera](#)![Image 12: Google Chrome](#)![Image 13: Safari](#) The autofocus property is supported in all major browsers. **Note:** Internet Explorer 9 and earlier IE versions, or Opera 12 and earlier Opera versions, do not support the autofocus property. **Note:** Internet Explorer or Safari browsers do not support the HTML element with the type="url" attribute. * * * ## Syntax Return the autofocus property: _urlObject_.autofocus Set the autofocus property: _urlObject_.autofocus=true|false ## Property Values | Value | Description | | --- | --- | | true|false | Specifies whether the URL field gets focus after page load * true - The URL field gets focus * false - Default. The URL field does not get focus | ## Technical Details | Return Value: | A Boolean. Returns true if the URL field automatically gets focus after page load, otherwise false. | | --- | * * * ## Related Pages HTML Reference: (#) * * Input URL Object](#)
← Prop Url AutofocusDom Obj Url β†’