HTML - textarea Tag
Advertisements
Description
The HTML <textarea> tag is used within a form to declare a textarea element - a control that allows the user to input text over multiple rows.
Example
Live Demo<!DOCTYPE html> <html> <head> <title>HTML textarea Tag</title> </head> <body> <form action = "/cgi-bin/hello_get.cgi" method = "get"> Fill the Detail: <br /> <textarea rows = "5" cols = "50" name = "description"> Enter your name </textarea> <input type = "submit" value = "submit" /> </form> </body> </html>
This will produce the following result −
Global Attributes
This tag supports all the global attributes described in − HTML Attribute Reference
Specific Attributes
The HTML <textarea> tag also supports the following additional attributes −
Attribute | Value | Description |
---|---|---|
autofocus ![]() |
autofocus | Specifies that on page load the text area should automatically get focus. |
cols | number | Specifies the width of the textarea based on the number of visible character widths. |
disabled | disabled | Specifies the width of the textarea based on the number of visible character widths. |
form![]() |
form_id | Specifies one or more forms. |
maxlength![]() |
number | Specifies the maximum number of characters in textarea. |
name | text | Assigns a name to the input control. |
placeholder ![]() |
text | Specifies a short hint of the value in textarea. |
readonly | readonly | Sets the input control to read-only. It won't allow the user to change the value. The control however, can receive focus and are included when tabbing through the form controls. |
required![]() |
required | Specifies that a textarea is required. |
rows | number | Specifies the height of the textarea based on the number of visible lines of text. If there's more text than this allows, users can scroll using the textarea's scrollbars. |
wrap ![]() |
hard soft |
Specifies the text to be wrapped in textarea. |
Event Attributes
This tag supports all the event attributes described in − HTML Events Reference
Browser Support
Chrome | Firefox | IE | Opera | Safari | Android |
---|---|---|---|---|---|
Yes | Yes | Yes | Yes | Yes | Yes |
html_tags_reference.htm
Advertisements