<textarea> Element
Technical Summary
The textarea element is a multiline plain-text edit control. Its contents represent the default value, which is distinct from the current value after user editing or DOM API changes.
textarea is a form-associated, labelable, listed, submittable, and resettable element. Its name, form, disabled state, constraint-validation state, and label association participate in form behavior.
Meaning, categories, and content model
| Item | Definition | Boundary to check |
|---|---|---|
| Meaning | A multiline plain-text edit control | It is not an HTML rich-text editing surface |
| Categories | Flow, phrasing, interactive, listed, labelable, submittable, resettable, form-associated, and palpable | Shared form-control, label, submission, and reset mechanisms apply |
| Content model | Text | Its contents provide the initial value; they are not HTML child elements to be rendered as markup |
| Tag omission | Neither the start nor end tag is omissible | Keep the closing tag even for an empty control |
Unlike a rich-text editor, a native textarea represents plain text. A visual line wrap and a newline inserted into the value submitted by a form are not necessarily the same thing.
Initial value, raw value, and current value
The element's contents represent its default value. When a user edits the control, its raw value changes, and the current API value is exposed through textarea.value. There is no value content attribute for setting a textarea's initial value in the way that input uses one.
<textarea id="note" name="note" rows="3">The initial value</textarea>
<script>
const note = document.querySelector('#note');
note.value; // current value
note.defaultValue; // reset baseline
</script>
| Concept | Meaning | Used for |
|---|---|---|
| Raw value | The value set on the control before normalization | Specification state and user editing |
| API value | The value with line breaks normalized to LF | value, textLength, minlength, and maxlength |
| Form value | The API value with additional wrap="hard" line breaks when required | Form submission and related processing |
User editing sets the dirty value flag. After that flag is set, changing the DOM child text does not necessarily update the current value in the same way. A form reset clears the flag and sets the raw value from the child text.
Mutability, readonly, and disabled
A textarea is mutable when it is neither disabled nor readonly. A mutable control lets the user edit its raw value, including inserting and removing LF line breaks.
| State | Editing | Constraint validation | Form submission |
|---|---|---|---|
| Default | Editable | Participates in conditions such as required | Eligible when its submission conditions, including name, are met |
readonly | Users cannot edit, but can read and select the text | Barred from constraint validation | Unlike disabled, it is not automatically excluded from submission |
disabled | Not interactive | Barred from constraint validation | Its value is not included in form submission |
readonly and disabled are not interchangeable presentation flags. Check editing, validation participation, and submission eligibility separately.
Important content attributes
| Attribute | Meaning | Condition or caution |
|---|---|---|
name | Name used for the submitted value and form.elements | Without a name, it normally does not contribute a form-submission entry |
form | Explicitly sets the form owner | Associates with a form in the same document |
required | Requires a non-empty value | A mutable textarea with an empty form value is suffering from being missing |
minlength / maxlength | Lower and upper value-length limits | The length of the newline-normalized API value is relevant |
placeholder | Short input hint when the value is empty | It is not a replacement for a label |
rows / cols | Hints for visible height and character width | Default rows is 2 and default cols is 20; final presentation also depends on CSS and the user agent |
wrap | Controls wrapping of the submitted value | soft does not add wrapping newlines on submission; hard does. Hard requires cols |
dirname | Names an entry for submitting the control's directionality | It can create a separate submission entry from the normal value |
autocomplete | Autofill hint | Interpret it together with the shared form-control autocomplete rules |
readonly / disabled | Change editing, interaction, validation, and submission state | Do not collapse their different consequences into one category |
Newline normalization and wrap
A textarea value has three relevant views. The raw value is not normalized. The API value normalizes line breaks to LF (U+000A). The form-submission value starts from the API value and can receive wrapping newlines under wrap="hard".
| Wrap state | Visual wrapping | Submitted value |
|---|---|---|
soft (default) | The rendering may wrap lines visually | Visual wrapping alone does not add submitted newlines |
hard | The rendering may wrap at the cols width | The user agent adds wrapping newlines for submission |
Therefore, the number of visual lines and the newline positions in a submitted string cannot be assumed to match. When a server processes line breaks, inspect the received value together with the wrap conditions.
Form submission and constraint validation
textarea is a form-associated submittable element. When it has a form owner, is not disabled, and meets conditions such as having a name, its form value contributes to the form's entry list.
<form action="/messages" method="post">
<label for="body">Body</label>
<textarea id="body" name="body" required minlength="10"></textarea>
<button type="submit">Send</button>
</form>
When required is present, the textarea is mutable, and its value is empty, constraint validation reports a missing value. minlength and maxlength constrain value length, while readonly and disabled affect validation participation. Browser validation is not a substitute for server-side validation.
DOM Interface
The textarea element is exposed through HTMLTextAreaElement.
| API | Summary |
|---|---|
value | Gets or sets the current API value; setting it affects the raw value and dirty value flag |
defaultValue | Gets or sets the initial-value baseline represented by the child text |
textLength | Reads the length of the API value |
selectionStart / selectionEnd | Gets or sets the selection range positions |
setSelectionRange() | Sets the selection range and direction |
setRangeText() | Replaces text in a selected range |
form / labels | Reads the form owner and associated labels |
willValidate / validity | Reads validation participation and current state |
checkValidity() / reportValidity() | Runs or reports constraint validation |
cols / rows / wrap | Handles visible-size and submission-wrapping conditions |
When user interaction changes the raw value, an input event is fired. Code that handles the event should still distinguish raw value, API value, and the value used for form submission.
Fact / Evidence
The main facts below are paired with their scope, verification state, and normative source. Browser and accessibility-tree observations are kept separate in the Implementation Evidence section.
| Type | Fact | Condition / Scope | Status | Source |
|---|---|---|---|---|
| SPEC | The textarea element is a multiline plain-text edit control, and its contents represent its default value. | Meaning and initial state of the textarea element. | Reviewed | HTML Standard: the textarea element |
| SPEC | Raw value, API value, and the value used for form submission differ in newline normalization and wrap processing. | LF normalization and submitted value under wrap="hard". | Reviewed | HTML Standard: value normalization |
| SPEC | User editing sets the dirty value flag, while form reset restores the value from the default-value text. | Initial value, DOM changes, user editing, and reset algorithm. | Reviewed | HTML Standard: textarea reset algorithm |
| SPEC | required treats an empty value in a mutable textarea as missing, while readonly bars the control from constraint validation. | Required, mutability, readonly, and constraint validation. | Reviewed | HTML Standard: validation conditions |
| SPEC | textarea is a form-associated submittable element; name, form, and disabled affect submission. | Form owner, entry list, disabled state, and forms API. | Reviewed | HTML Standard: form control infrastructure |
| SPEC | HTML-AAM maps a native textarea to the textbox role with multiline=true. | Native accessible-role mapping. | Reviewed | HTML-AAM: textarea |
Evidence
- HTML Standard: The textarea element — meaning, categories, content model, attributes, values, reset, and DOM interface
- HTML Standard: Form control infrastructure — form owners, disabled state, constraint validation, and shared submission model
- HTML Accessibility API Mappings: textarea — textbox role, multiline state, accessible name, and state mappings
- WPT: textarea element tests — tests related to textarea values, attributes, and form behavior
- WPT: input events and textarea editing — an example covering editing actions and input events
Implementation Evidence
Browser behavior, WPT results, and accessibility observations are recorded separately from normative claims. Unrun items are not treated as reviewed.
Measured fixture / environment: The fixture contains an initial-value textarea, empty required textarea, minlength and maxlength, readonly, disabled, wrap="hard", an external form owner, and a reset button inside or alongside <form id="evidence-form" method="get">. DOM, ValidityState, and FormData were measured in Chrome 152.0.0.0 (HeadlessChrome / Windows NT 10.0) on 2026-09-13.
| Type | Reproduction scope | Conditions to record | Status |
|---|---|---|---|
| IMPL | Initial value, value, defaultValue, dirty value flag, DOM changes, and form reset | Measured result (Chrome 152.0.0.0 / Windows NT 10.0 / 2026-09-13): child text supplied the same initial value to value, defaultValue, and textContent. Changing value to Edited left defaultValue and textContent unchanged; reset restored the initial value | Reviewed |
| IMPL | required, minlength, maxlength, readonly, disabled, form owner, and submission | Measured: empty required produced valid=false and valueMissing=true, while ok was valid. readonly had willValidate=false. The disabled textarea was absent from FormData and the external-form textarea was included. Programmatic value assignment did not set tooShort / tooLong; the user-edit path remains unrun | Incomplete |
| IMPL | Newlines, rows, cols, and wrap="soft" / hard | Measured: with wrap="hard", cols=4, and value abcdefghij, FormData contained abcdef\nghij. Visual wrapping, LF / CRLF variants, and changed cols widths were not run | Incomplete |
| WPT | Textarea element, initial/current values, attributes, selection, form submission, and input events | From the textarea element tests, ran textarea-type.html, textarea-minlength.html, and textarea-validity-valueMissing-inside-datalist.html, and also checked the input events test. On 2026-09-15 in Chrome 152.0.0.0 / Windows NT 10.0, selected textarea tests passed 7/7; input events passed 0/3 because action_sequence() is not implemented. Remaining directory coverage and other browsers remain open. | Partial (7/10 pass) |
| AAM | Accessible name, textbox role, multiline state, and required / readonly / disabled states | Observe a labeled textarea and each state in the accessibility tree and assistive technology; record the environment after measurement | Pending |
Use the WPT repository for test mappings and HTML-AAM for accessibility criteria.
Coverage / Open Issues
- ReviewedTextarea meaning, categories, content model, initial/current/default values, major attributes, and the HTMLTextAreaElement API overview
- ReviewedRequired, minlength, maxlength, readonly, disabled, form owner, and major form-submission boundaries
- ReviewedRaw value, API value, form value, LF normalization, and the basic relationship with wrap
- OpenAll branches of the form-submission algorithm, entry-list construction, dirname, encoding, and formdata event
- OpenThe wrap="hard" wrapping algorithm, newline and Unicode edge cases, and implementation differences in value length
- OpenImplementation evidence, multiple browsers, WPT execution, complete HTML-AAM mapping, assistive-technology observations, compatibility, historical changes, and Expert-gap Review
This is initial coverage. It does not claim that the entire textarea element has been verified, that every browser exposes the same value or presentation, or that assistive technologies produce the same result.
Related surface
For a beginner-friendly explanation of multiline input, labels, initial values, and form submission, see the textarea element page in Yugien. The shared form-submission model is covered by the form element in Atlas; label association by the label element; and boundaries with other form controls by the input, select, and button pages.