Prop Search Autofocus
# Input Search autofocus Property
[ Input Search Object](#)
## Example
Check if the search field automatically gets focus after the page loads:
var x = document.getElementById("mySearch").autofocus;
The output of _x_ is:
true
[Try it yourself Β»](#)
* * *
## Definition and Usage
The autofocus property sets or returns whether a search field should automatically get focus when the page loads.
This property reflects the HTML autofocus attribute.
* * *
## Browser Support

The autofocus property is supported in all major browsers.
**Note:** The autofocus property is not supported in Internet Explorer 9 and earlier IE versions or Opera 12 and earlier Opera versions.
* * *
## Syntax
Return the autofocus property:
_searchObject_.autofocus
Set the autofocus property:
_searchObject_.autofocus=true|false
## Property Values
| Value | Description |
| --- | --- |
| true|false | Specifies whether the search field gets focus when the page loads * true - The search field gets focus * false - Default. The search field does not get focus |
## Technical Details
| Return Value: | A Boolean. Returns true if the search field automatically gets focus after the page loads, otherwise false. |
| --- |
* * *
## Related Pages
HTML Reference: (#)
* * Input Search Object](#)
YouTip