AvailabilityJavaScript 1.0; enhanced in JavaScript 1.1 Inherits from/OverridesInherits from Input, HTMLElement Synopsisform.name form.elements[i] PropertiesTextarea inherits the properties of Input and HTMLElement and defines or overrides the following:
MethodsTextarea inherits the methods of Input and HTMLElement. Event HandlersTextarea inherits the event handlers of Input and HTMLElement and defines or overrides the following:
HTML SyntaxA 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" ] // How many characters wide the element is [ onchange="handler" ] // The onchange( ) event handler > plain_text // The initial text; specifies defaultValue </textarea> ... </form> DescriptionThe Textarea element represents a text input field in a form. The name attribute specifies a name for the element. This is mandatory if the form is to be submitted, and it also provides a convenient way to refer to the Textarea element from JavaScript code. The cols attribute specifies the width, in characters, of the element as it appears on the screen, and the rows attribute specifies the height, in lines of text, of the element. The wrap attribute specifies how long lines should be handled: the value off specifies that they should be left as-is, the value virtual specifies that they should be displayed with line breaks but transmitted without them, and the value physical specifies that they should be displayed and transmitted with line breaks inserted. In addition to these HTML attributes, value is the main property of interest for the Textarea element. You can read this property to obtain the user's input or set it to display arbitrary (unformatted) text in the Textarea. The initial value of the value property (and the permanent value of the defaultValue property) is the text that appears between the <textarea> and </textarea> tags. Note that the Textarea object is a kind of Input object and inherits from Input, despite the fact that Textarea objects are not created with HTML <input> tags. UsageIf you need only a single line of input text, use the Text element. If the text to be input is sensitive information, such as a password, use the Password element. See AlsoForm, HTMLElement, Input, Password, Text; HTMLTextAreaElement in the DOM reference section |