Last Updated : 04 Jul, 2023
The HTML <textarea> autofocus Attribute is used to specify that the textarea field should get automatically focus when the page loads. It is a Boolean Attribute.
Syntax:
<textarea autofocus>
Example: This Example illustrates the use of autofocus attribute in Textarea Element.
html
<!DOCTYPE html>
<html>
<head>
<title>
HTML textarea autofocus Attribute
</title>
</head>
<body style="text-align:center">
<h1 style="color: green;">
GeeksforGeeks
</h1>
<h2>
HTML Textarea autofocus Attribute
</h2>
<textarea id="geeks" autofocus>
write something here----
</textarea>
</body>
</html>
Output:
HTML textarea autofocusSupported Browsers:
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4