HTML <textarea> Tag
In this tutorial, we will learn about textarea tag in HTML with the help of examples.
<textarea> Tag
Textarea tag <textarea> is used to define a multi-line text input control within a form to declare
a textarea element.
It is used inside the form to collect the user inputs.
Note : The <textarea> tag can hold an unlimited number of characters.
Syntax
<textarea>..........</textarea>
Example
<!DOCTYPE html>
<html>
<head>
<title>textarea Tag</title>
</head>
<body>
<form>
Fill the detail in the form :
<textarea row = "7" cols = "50" name = "Review">
Enter your name :
</textarea><br>
<input type = "submit" value = "submit"/>
</form>
</body>
</html>
Output
Specific Attribute
Attribute | Value | Description |
---|---|---|
autofocus | autofocus | It is used to specify that on page load the text area should automatically get focus |
col | number | It specifies the width of the textarea based on the number of visible charcter widths |
disable | disable | It is used to disable the textarea |
form | form_id | It specifies one or more forms |
maxlength | number | It specifies the maximum number of characters in textarea |
name | text | It is used to assign a name to the input control |
placeholder | text | It specifies a short hint of the value in textarea |
readonly | readonly | It is used to set the input control to read-only. It won't allow the user to change the value. The control however, can recieve focus and are included when tabbing through the form control. |
required | required | It is used to specify that a textarea is required |
rows | number | It is used to height of the textarea based on the number of visible lines of text. If there's more text than this allows, user can scroll using the textarea's scrollbars |
wrap | hard soft |
It specifies the text to be wrapped in textarea |
Global Attribute
Textarea Tag support all the global attributes of HTML.
Event Attribute
Textarea Tag support all the event attributes of HTML.
Next Tutorial
We hope that this tutorial helped you develop better understanding of the concept of <textarea> tag in HTML.
Keep Learning : )
In the next tutorial, you'll learn about HTML <tfoot>
Tag.