
- HTML Tutorial
- HTML - Home
- HTML - Overview
- HTML - Basic Tags
- HTML - Elements
- HTML - Attributes
- HTML - Formatting
- HTML - Phrase Tags
- HTML - Meta Tags
- HTML - Comments
- HTML - Images
- HTML - Tables
- HTML - Lists
- HTML - Text Links
- HTML - Image Links
- HTML - Email Links
- HTML - Frames
- HTML - Iframes
- HTML - Blocks
- HTML - Backgrounds
- HTML - Colors
- HTML - Fonts
- HTML - Forms
- HTML - Embed Multimedia
- HTML - Marquees
- HTML - Header
- HTML - Style Sheet
- HTML - Javascript
- HTML - Layouts
- HTML References
- HTML - Tags Reference
- HTML - Attributes Reference
- HTML - Events Reference
- HTML - Fonts Reference
- HTML - ASCII Codes
- ASCII Table Lookup
- HTML - Color Names
- HTML - Entities
- HTML - Fonts Ref
- HTML - Events Ref
- MIME Media Types
- HTML - URL Encoding
- Language ISO Codes
- HTML - Character Encodings
- HTML - Deprecated Tags
HTML
The autofocus attribute of the <textarea> element is used to set the autofocus to the textarea itself when the page loads. The autofocus attribute for the <textarea> element introduced in HTML5.
Following is the syntax −
<textarea autofocus>
Let us now see an example to implement the autofocus attribute of the <textarea> element −
Example
<!DOCTYPE html> <html> <body> <h2>Interview Questions</h2> <p>Why do you want go for the Technical Writer Job Profile? (100 words)</p> <textarea rows="6" cols="70" autofocus> Write the answer in 100 words only... </textarea> <p>What are your strengths? (50 words)</p> <textarea rows="4" cols="70" autofocus> Write the answer in 50 words only... </textarea> </body> </html>
Output
In the above example, we have set two textarea−
<textarea rows="6" cols="70" autofocus> Write the answer in 100 words only... </textarea> <p>What are your strengths? (50 words)</p> <textarea rows="4" cols="70" autofocus> Write the answer in 50 words only... </textarea>
One of these textarea we have set with autofocus. Now whenever the page loads, the focus and the cursor will automatically be visible in the first textarea −
<textarea rows="6" cols="70" autofocus>
- Related Articles
- HTML DOM Textarea autofocus Property
- HTML autofocus Attribute
- HTML autofocus Attribute
- HTML autofocus Attribute
- HTML autofocus Attribute
- Usage of autofocus HTML5 attribute
- HTML DOM Textarea Object
- HTML DOM Textarea cols Property
- HTML DOM Textarea rows Property
- HTML DOM Textarea placeholder Property
- HTML DOM Textarea disabled Property
- HTML DOM Textarea defaultValue Property
- HTML DOM Textarea name Property
- HTML DOM Textarea readOnly Property
- HTML DOM Textarea wrap Property

Advertisements