HTML: The Markup Language

textareatext input area # T

The textarea element represents a multi-line plain-text edit control for the element’s raw value.

Permitted content #

Permitted attributes #

Descriptions for attributes specific to this element #

rows = positive integer
The number of lines of text for the UA to show.
wrap = "hard" NEW
Instructs the UA to insert line breaks into the submitted value of the textarea, such that each line has no more characters than the value specified by the cols attribute.
cols = positive integer
The expected maximum number of characters per line of text for the UA to show.
wrap = "soft" NEW
Instructs the UA to add no line breaks to the submitted value of the textarea.

Additional constraints and admonitions #

Tag omission #

A textarea element must have both a start tag and an end tag.

Permitted parent elements #

any element that can contain phrasing elements

Details #

The contents of the textarea element represent the control’s default value.

DOM interface #

interface HTMLTextAreaElement : HTMLElement {
           attribute boolean autofocus;
           attribute unsigned long cols;
           attribute boolean disabled;
  readonly attribute HTMLFormElement form;
           attribute long maxLength;
           attribute DOMString name;
           attribute DOMString placeholder;
           attribute boolean readOnly;
           attribute boolean required;
           attribute unsigned long rows;
           attribute DOMString wrap;

  readonly attribute DOMString type;
           attribute DOMString defaultValue;
           attribute DOMString value;
  readonly attribute unsigned long textLength;

  readonly attribute boolean willValidate;
  readonly attribute ValidityState validity;
  readonly attribute DOMString validationMessage;
  boolean checkValidity();
  void setCustomValidity(in DOMString error);

  readonly attribute NodeList labels;

  void select();
           attribute unsigned long selectionStart;
           attribute unsigned long selectionEnd;
  void setSelectionRange(in unsigned long start, in unsigned long end);