HTML <textarea> autofocusAttribute

HTML textarea 标签参考手册HTML <textarea> Tag

Examples

A text area that automatically gets focus:

<textarea autofocus>
At example.com you will learn how to create websites. We provide basic web technology tutorials.
</textarea>

Try it Yourself »

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Internet Explorer 10, Firefox, Opera, Chrome, and Safari support the autofocus attribute.

Note:Internet Explorer 9 and earlier versions support the autofocus attribute of the <textarea> tag.


Definition and Usage

The autofocus attribute is a boolean attribute.

The autofocus attribute specifies that the text area should automatically get focus when the page loads.


Differences between HTML 4.01 and HTML5

The autofocus attribute is a new attribute of the <textarea> tag in HTML5.


Differences between HTML and XHTML

In XHTML, attribute minimization is forbidden, and the autofocus attribute must be defined as <textarea autofocus="autofocus">.


Syntax

<textarea autofocus>


HTML textarea 标签参考手册HTML <textarea> Tag Other extensions