Advertisement
Home Open Editor ❯

HTML <textarea> autofocus Attribute

Example

<form action="action.php">
  <textarea autofocus name="textareaText">Hello world!</textarea>

  <input type="submit" value="Submit">
</form>

Try this code ❯

Meaning

The autofocus attribute specifies that the user agent should immediately focus this form item once its containing window object (usually the document) loaded.


Standard Syntax

HTML: <textarea autofocus>...</textarea>

XHTML: <textarea autofocus="autofocus">...</textarea>


Advertisement

Attribute Values

Value Description
autofocus This is a boolean attribute, the presence of a boolean attribute on an element represents the true value, and the absence of the attribute represents the false value.
Home Open Editor ❯
Advertisement