The <textarea>
element
A text box for entering a relatively large amount of text, which might span multiple lines. It allows the user to press Return to add line breaks, whereas a normal text box would submit the form when that happened.
Full list of attributes
All the usual HTML global attributes are available
autofocus
- Indicates that this text area should be where the keyboard focus goes when the page is first loaded.
cols
- The width the box should be, expressed as the number of characters that the browser should be able to display across one line of text. Text areas are twenty columns wide by default.
dirname
- A name to be used for submitting a field indicating the directionality of the main value the text area submits. The name given will be submitted with the value
ltr
orrtl
depending on the language used for the text. disabled
- If present, the control will be disabled and will not be editable or submit its value when the rest of the form is submitted.
form
- The form with which this text area should be associated.
maxlength
- The maximum number of characters of text that the browser should allow the user to enter in this control.
minlength
- The minimum number of characters of text that the browser should allow the user to enter in this control.
name
- The name which should be used for the value generated by this text area when the form is submitted.
placeholder
- A piece of text to display in the text area to indicate what it's for (as an alternative to a label outside the text box).
readonly
- If present, the text is displayed as normal, but cannot be edited by the user. The text is still included as part of the form's data when the form is submitted.
required
- If no text has been entered and this attribute is used, then the browser should consider that a validity error when the form is submitted.
rows
- The number of lines of text that should be visible in the text area. The browser will choose the size it thinks will allow this many lines to fit in. The default is two lines.
wrap
- Must be either
soft
(the default) orhard
. If set tohard
then the browser will add line breaks when the text is submitted, using thecols
attribute to decide how long each line will be.