In this section, we will learn what the autofocus is and how to use it.
What is autofocus Attribute in HTML <textarea> Tag?
The autofocus attribute is used to set the focus on the target textarea field when the HTML document is loaded.
Basically, if the first thing you want from audiences is to put a comment or a review for something on your webpage, then you can set the autofocus attribute in the target <textarea> element so that when the page is loaded, the focus is on the field and users can start to comment right away.
HTML autofocus Attribute in <textarea> Tag Syntax:
<textarea> Content </textarea>
<textarea> Tag autofocus Attribute Values
We only need to put the autofocus attribute in the opening tag of the target <textarea> element.
This attribute does not need a value.
Example: using autofocus attribute in HTML <textarea> tag
See the Pen using autofocus attribute in HTML <textarea> tag by Omid Dehghan (@odehghan) on CodePen.