DOM Interfaces

HTMLTextAreaElement

Represents a multiline text control with a current value, selection range and validation API. Initial content comes from text between the tags, not a value attribute. The value property can diverge from defaultValue. Example result: Hello.

Formal Syntax & Structure

html syntaxhtml
const element = document.getElementById('demo'); // HTMLTextAreaElement

Return Value

HTMLTextAreaElement

An existing HTML DOM object associated with the textarea element in this example; this interface is a type, not a function return contract.

Working Example

Example Snippethtml
<label>Note <textarea id="demo">Hello</textarea></label><p>Result: <output id="result"></output></p><script>const e = document.getElementById('demo');const result = value => { document.getElementById("result").textContent = String(value); };result(e.value);</script>
HTML Reference