Open In App

HTML <textarea> autofocus Attribute

Last Updated : 04 Jul, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

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:

textAreaAutofocus.png

HTML textarea autofocus

Supported Browsers:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Opera
  • Safari

Previous Article
Next Article

Similar Reads

HTML | DOM Textarea autofocus Property
The DOM Textarea autofocus Property is used to set or return whether the element should get focus when the page loads. This property is used to reflect the HTML autofocus attribute. Syntax: It is used to Return the autofocus property. textareaObject.autofocusIt is used to Set the autofocus property. textareaObject.autofocus = true|false Property Va
2 min read
HTML &lt;button&gt; autofocus Attribute
The HTML &lt;button&gt; autofocus Attribute is used to specify whether the button should get automatically get focused or not when the page loads. It is a Boolean Attribute. Syntax: &lt;button type="button" autofocus&gt; Example: This Example illustrates the use of autofocus attribute in Button Element. C/C++ Code &lt;!DOCTYPE html&gt; &lt;html&gt;
1 min read
HTML input autofocus Attribute
The HTML &lt;input&gt; autofocus Attribute is used to specify that the input field must automatically get focused when the page loads which means the cursor will blink to the specified input field. It is a Boolean attribute. Syntax: &lt;input autofocus&gt; Example: This Example illustrates the use of autofocus attribute in &lt;input&gt; element. C/
1 min read
HTML | &lt;select&gt; autofocus Attribute
The HTML &lt;select&gt; autofocus Attribute is used to specify that the dropdown should automatically get focus when the page loads. It is a type of boolean attribute. Syntax: &lt;select autofocus&gt; Example: This Example that illustrates the use of autofocus attribute in select Element. &lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title
1 min read
HTML &lt;keygen&gt; autofocus Attribute
The HTML &lt;keygen&gt; autofocus Attribute is used to specify that the &lt;keygen&gt; element should get focused when the page loads. It is a boolean attribute. Note: It supports only the following elements: &lt;button&gt;, &lt;input&gt;, &lt;select&gt; and &lt;textarea&gt; Syntax: &lt;keygen autofocus&gt; Example: Below example illustrates the au
1 min read
HTML autofocus Attribute
The HTML autofocus attribute is a powerful tool that enhances user experience by automatically setting the focus to a specific element when a webpage loads. This attribute is boolean, meaning it can either be present or absent. Syntax: &lt;elementName autofocus&gt;Supported Tags ElementPurposeButton autofocus AttributeAutomatically focuses the butt
2 min read
HTML &lt;textarea&gt; disabled Attribute
The disabled attribute for &lt;textarea&gt; element in HTML is used to specify that the text area element is disabled. A disabled text area is un-clickable and unusable. It is a boolean attribute. Syntax: &lt;textarea disabled&gt;text content...&lt;/textarea&gt; Example: C/C++ Code &amp;lt;!DOCTYPE html&amp;gt; &amp;lt;html&amp;gt; &amp;lt;head
1 min read
HTML | &lt;textarea&gt; placeholder Attribute
The &lt;textarea&gt; placeholder attribute in HTML is used to specify the expected value to be displayed before user input in textarea element. Syntax: &lt;textarea placeholder="text"&gt; Attribute Value: This attribute contains single value text which is the initial string to be displayed before user input. Example 1: This example uses &lt;textare
2 min read
HTML | &lt;textarea&gt; cols Attribute
The HTML &lt;textarea&gt; cols Attribute is used to tell the browser how many average-width characters should fit on a single line i.e the number of columns to display. It is used to specify the visible width of the &lt;Textarea&gt; Element. Syntax: &lt;textarea cols="number"&gt; Attribute Values: It contains the value i.e number which specifies th
1 min read
HTML | &lt;textarea&gt; required Attribute
The HTML &lt;textarea&gt; required Attribute is a Boolean attribute which is used to specify that the &lt;textarea&gt; element must be filled out before submitting the Form. Syntax: &lt;textarea required&gt; Example: This Example illustrates the use of required attribute in Textarea Element. C/C++ Code &amp;lt;!DOCTYPE html&amp;gt; &amp;lt;html
1 min read