HTML textarea Tag



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.


<!DOCTYPE html>
<title>HTML textarea Tag</title>
<form action="/cgi-bin/hello_get.cgi" method="get">
Fill the Detail: <br />
<textarea rows="5" cols="50" name="description">
Enter your name
<input type="submit" value="submit" />

This will produce following result:

Fill the Detail:

Global Attributes

This tag supports all the global attributes described in - HTML Attribute Reference

Specific Attributes

The HTML <textarea> tag also supports following additional attributes:

autofocus html-5autofocusSpecifies that on page load the text area should automatically get focus.
cols numberSpecifies the width of the textarea based on the number of visible character widths.
disabled disabledSpecifies the width of the textarea based on the number of visible character widths.
formhtml-5form_idSpecifies one or more forms.
maxlengthhtml-5numberSpecifies the maximum number of characters in textarea.
name textAssigns a name to the input control.
placeholder html-5textSpecifies a short hint of the value in textarea.
readonly readonlySets 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.
requiredhtml-5requiredSpecifies that a textarea is required
rows numberSpecifies 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 html-5hard
Specifies the text to be wrapped in textarea.

Event Attributes

This tag supports all the event attributes described in - HTML Events Reference

Browser Support