The HTML <textarea></textarea> element represents a multi-line plain-text editing control.


Attribute Value Description
autofocus Boolean This Boolean attribute lets you specify that a form control should have input focus when the page loads, unless the user overrides it, for example by typing in a different control. Only one form-associated element in a document can have this attribute specified. (HTML5)
cols positive integer The visible width of the text control, in average character widths. If it is specified, it must be a positive integer. If it is not specified, the default value is 20. (HTML5)
disabled Boolean This Boolean attribute indicates that the user cannot interact with the control. (If this attribute is not specified, the control inherits its setting from the containing element; if there is no containing element with the disabled attribute set, then the control is enabled).
form id The form element that the <textarea> element is associated with (its "form owner"). The value of the attribute must be an id of a <form> element in the same document. If this attribute is not specified, the <textarea> element must be a descendant of a <form> element. This attribute enables you to place <textarea> elements anywhere within a document, not just as descendants of their <form> elements. (HTML5)
maxlength number The maximum number of characters (Unicode code points) that the user can enter. If it is not specified, the user can enter an unlimited number of characters. (HTML5)
name name The name of the control.
placeholder hint A hint to the user of what can be entered in the control. The placeholder text must not contain carriage returns or line-feeds. (HTML5)
readonly Boolean This Boolean attribute indicates that the user cannot modify the value of the control. Unlike the disabled attribute, the readonly attribute does not prevent the user from clicking or selecting in the control. The value of a read-only control is still submitted with the form.
required This attribute specifies that the user must fill in a value before submitting a form. (HTML5)
rows number The number of visible text lines for the control.
wrap hard
Indicates how the control wraps text.

  • hard: The browser automatically inserts line breaks (CR+LF) so that each line has no more than the width of the control; the cols attribute must be specified.
  • soft: The browser ensures that all line breaks in the value consist of a CR+LF pair, but does not insert any additional line breaks.

If this attribute is not specified, soft becomes the default.

HTML example:

<textarea name="foo" rows="3" cols="40">
Default <textarea> value goes here.
Community content is available under CC-BY-SA unless otherwise noted.