The
textarea
element represents a multi-line plain-text edit control for
the element’s raw value.
Permitted attributes #
-
ⓘ
global attributes
- Any attributes permitted globally.
-
ⓘ
name = string
#
- The name part of the name/value pair associated with this
element for the purposes of form submission.
-
ⓘ
disabled =
"disabled"
or "" (empty string) or empty
#
- Specifies that the element represents a disabled
control.
-
ⓘ
form =
ID reference
NEW
#
- The value of the
id
attribute on the
form
with which to associate the element.
-
ⓘ
readonly =
"readonly"
or "" (empty string) or empty
#
- Specifies that element represents a control whose value
is not meant to be edited.
-
ⓘ
maxlength =
non-negative integer
#
- The maximum allowed value length of the element.
-
ⓘ
autofocus =
"autofocus"
or "" (empty string) or empty
NEW
#
- Specifies that the element represents a control to which
a UA is meant to give focus as soon as the document is
loaded.
-
ⓘ
required =
"required"
or "" (empty string) or empty
NEW
#
- Specifies that the element is a required part of form
submission.
-
ⓘ
placeholder =
string without line breaks
NEW
#
- A short hint (one word or a short phrase) intended to
aid the user when entering data into the control
represented by its element.
Any string that contains no line feed (U+000A, “LF”) or carriage
return (U+000D, “CR”) characters.
-
ⓘ
dirname =
non-empty string
NEW
#
- Enables submission of a value for the directionality of the
element, and gives the name of the field that contains that
value.
Any string that is not empty.
-
ⓘ
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.
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 DOMString dirName;
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(DOMString error);
readonly attribute NodeList labels;
void select();
attribute unsigned long selectionStart;
attribute unsigned long selectionEnd;
attribute DOMString selectionDirection;
void setSelectionRange(unsigned long start, unsigned long end, optional DOMString direction);
};