Textarea Element



Textarea element is used to create a text box in order to allow an user to write his/her comments.
<textarea rows="Value" cols="Value">Text</textarea>
Element Specific attributes supported by this element are:
autofocus autofocus Text area will get focus automatically, if the page loads.
cols number Mentions the visible width of a text area.
disabled disabled The text area must be disabled.
form form_id The forms to which the text area is related to.
maxlength number Signifies, how many characters will be permitted in a text area.
name text Defines name for text area.
placeholder text Short hint that exhibits the expected value of a text area.
readonly readonly The text area must be read only.
required required The text is required or it should be filled out.
rows nuumber Denotes the visible lines in a text area.
wrap hard, soft When form is submitted, how the text in a text area should be wrapped.

Example Code:

Result :

  • Use the "cols and rows" attributes to adjust size of textarea.
  • It gives opportunity for the user to modify the contents in a webpage.
  • User is allowed to enter contents in the text area.
It is available in the previous versions of HTML.
It supports both Global Attributes and Event Attributes in HTML5.


It will function in all the major browsers.

Ask Questions

Ask Question