HTML textarea Tag
HTML textarea Tag
The textarea tag is a multi-line text input control. It is used in a form that collects user input like comments or reviews. It can hold an unlimited number of characters. We can specify its size by cols and rows attributes. The name attribute is needed to reference the form data after the form is submitted. The id attribute is needed to associate the text area with a label. For best performance, we use label tag with it.
Attribute Explanation:-
Attribute | Value | Description |
---|---|---|
autofocus | autofocus | Specifies that a text area should automatically get focus when the page loads |
cols | number | Specifies the visible width of a text area |
dirname | textareaname.dir | Specifies that the text direction of the textarea will be submitted |
disabled | disabled | Specifies that a text area should be disabled |
form | form_id | Specifies which form the text area belongs to |
maxlength | number | Specifies the maximum number of characters allowed in the text area |
name | text | Specifies a name for a text area |
placeholder | text | Specifies a short hint that describes the expected value of a text area |
readonly | readonly | Specifies that a text area should be read-only |
required | required | Specifies that a text area is required/must be filled out |
rows | number | Specifies the visible number of lines in a text area |
wrap | hard soft |
Specifies how the text in a text area is to be wrapped when submitted in a form. |
Syntax:-
Its syntax is:- < textarea >