Name
Textarea — a multiline text input area
Availability
JavaScript 1.0; enhanced in JavaScript 1.1
Inherits from/Overrides
Inherits from Input, HTMLElement
Synopsis
form
.name
form
.elements[i
]
Properties
Textarea inherits the properties of Input and HTMLElement and defines or overrides the following:
-
value
A read/write string property. The initial value of this property is the same as the
defaultValue
property: the plain text (i.e., without any HTML tags) that appears between the<textarea>
and</textarea>
tags. When the user types characters into the Textarea object, thevalue
property is updated to match the user’s input. If you set thevalue
property explicitly, the string you specify is displayed in the Textarea object. Thisvalue
property contains the string that is sent to the server when the form is submitted.
Methods
Textarea inherits the methods of Input and HTMLElement.
Event Handlers
Textarea inherits the event handlers of Input and HTMLElement and defines or overrides the following:
-
onchange
Invoked when the user changes the value in the Textarea element and moves the keyboard focus elsewhere. This event handler is not invoked for every keystroke in the Textarea element, but only when the user completes an edit.
HTML Syntax
A Textarea element is created with
standard HTML <textarea>
and
</textarea>
tags:
<form> ... <textarea [ name="name
" ] // A name that can be used to refer to this element [ rows="integer
" ] // How many lines tall the element is [ cols="integer
" ] // ...
Get JavaScript: The Definitive Guide, Fourth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.