Get to know MDN better
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
* Some parts of this feature may have varying levels of support.
The HTMLTextAreaElement interface provides properties and methods for manipulating the layout and presentation of <textarea> elements.
EventTarget Node Element HTMLElement HTMLTextAreaElementAlso inherits properties from its parent interface, HTMLElement.
autocompleteA string that represents the element's autocomplete attribute.
colsA number that represents the element's cols attribute, indicating the visible width of the text area.
defaultValueA string that represents the control's default value, which behaves like the Node.textContent property.
dirNameA string that represents the directionality of the element.
disabledA boolean that represents the element's disabled attribute, indicating that the control is not available for interaction.
form Read onlyReturns a reference to the parent form element. If this element is not contained in a form element, it can be the id attribute of any <form> element in the same document or the value null.
labels Read onlyReturns a NodeList of the <label> elements associated with this element.
maxLengthA number that represents the element's maxlength attribute, indicating the maximum number of characters the user can enter. This constraint is evaluated only when the value changes.
minLengthA number that represents the element's minlength attribute, indicating the minimum number of characters the user can enter. This constraint is evaluated only when the value changes.
nameA string that represents the element's name attribute, containing the name of the control.
placeholderA string that represents the element's placeholder attribute, containing a hint to the user about what to enter in the control.
readOnlyA boolean that represents the element's readonly attribute, indicating that the user cannot modify the value of the control.
requiredA boolean that represents the element's required attribute, indicating that the user must specify a value before submitting the form.
rowsA number that represents the element's rows attribute, indicating the number of visible text lines for the control.
selectionDirectionA string that represents the direction in which selection occurred. This is forward if selection was performed in the start-to-end direction of the current locale, or backward for the opposite direction. This can also be none if the direction is unknown.
selectionEndA number that represents the index of the end of selected text. If no text is selected, it contains the index of the character that follows the input cursor. On being set, the control behaves as if setSelectionRange() had been called with this as the second argument, and selectionStart as the first argument.
selectionStartA number that represents the index of the beginning of selected text. If no text is selected, it contains the index of the character that follows the input cursor. On being set, the control behaves as if setSelectionRange() had been called with this as the first argument and selectionEnd as the second argument.
textLength Read onlyReturns the code point length of the control's value. Same as reading value.length.
type Read onlyReturns the string textarea.
validationMessage Read onlyReturns a localized message that describes the validation constraints that the control does not satisfy (if any). This is the empty string if the control is not a candidate for constraint validation (willValidate is false), or it satisfies its constraints.
validity Read onlyReturns the validity state that this element is in.
valueA string that represents the raw value contained in the control.
willValidate Read onlyReturns whether the element is a candidate for constraint validation. false if any conditions bar it from constraint validation, including its readOnly or disabled property is true.
wrapA string that represents the element's wrap attribute, indicating how the control wraps text.
Also inherits methods from its parent interface, HTMLElement.
checkValidity()Returns false if the element is a candidate for constraint validation, and it does not satisfy its constraints. In this case, it also fires a cancelable invalid event at the control. It returns true if the control is not a candidate for constraint validation, or if it satisfies its constraints.
reportValidity()This method reports the problems with the constraints on the element, if any, to the user. If there are problems, it fires a cancelable invalid event at the element, and returns false; if there are no problems, it returns true.
select()Selects the contents of the control.
setCustomValidity()Sets a custom validity message for the element. If this message is not the empty string, then the element is suffering from a custom validity error, and does not validate.
setRangeText()Replaces a range of text in the element with new text.
setSelectionRange()Selects a range of text in the element (but does not focus it).
Also inherits events from its parent interface, HTMLElement.
Listen to these events using addEventListener() or by assigning an event listener to the oneventname property of this interface:
select eventFires when some text has been selected.
selectionchange eventFires when the text selection in a <textarea> element has been changed.
Make a textarea autogrow while typing:
Insert some HTML tags in a textarea:
Decorate the span to behave like a link:
| HTML # htmltextareaelement |
Enable JavaScript to view this browser compatibility table.
This page was last modified on Aug 8, 2025 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.