HTML
Example
A text area that automatically gets focus:
Try it »
Browser support





Internet Explorer 10, Firefox, Opera, Chrome, and Safari support the autofocus attribute.
**Note:** Internet Explorer 9 and earlier versions support
Definition and Usage
The autofocus attribute is a boolean attribute.
The autofocus attribute specifies that the text area should automatically gain focus when the page loads.
Differences between HTML 4.01 and HTML5
The autofocus attribute is new in HTML5
Differences between HTML and XHTML
In XHTML, attribute minimization is forbidden, and the autofocus attribute must be defined as
Syntax
HTML