Gets the content of a <textarea> element.
Property of dom/HTMLTextAreaElementdom/HTMLTextAreaElement
Syntaxvar textAreaContent = textAreaElement.value;
textAreaElement.value = newTextAreaContent;
Return Value
Returns an object of type StringString
The content of the element, whether entered, existing or otherwise visible.
ExamplesThe following code uses this property to log the content of a <textarea>
and its length.
var textAreaList, textArea;
textAreaList = document.getElementsByTagName("textarea");
if (textAreaList.length) {
textArea = textAreaList[0];
console.log("The content of the first textarea element is - " +
textArea.value);
console.log("The codepoint length of the content of the first textarea element is - " +
textArea.value.length);
}
Usage
Use this property to get the content of <textarea>.
Notes
In JavaScript/ECMAScript, the length property of this property can be used to determine the codepoint length of the content.
Related specificationsvalue
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4