HTML <textarea> tag
Definition
The <textarea> tag is used to define used to define a multiple line area for text input.
Example
<textarea rows="3" cols="30" name="comments"></textarea>
Required Attributes
cols - specifies the character width of the text area.
rows - specifies the number of rows in the text area.
<textarea rows="3" cols="30"></textarea>
Optional Attributes
disabled - specifies the textarea will be disabled until a certain condition occurs.
<textarea rows="3" cols="30" disabled="disabled"></textarea>
name - specifies a name for the text area.
<textarea rows="3" cols="30" name="name"></textarea>
readonly - specifies that a text area is protected and not modifiable.
<textarea rows="3" cols="30" readonly="readonly"></textarea>
Common Attributes
accesskey - specifies a keyboard shortcut to an element.
<textarea rows="3" cols="30" accesskey="aKey"></textarea>
class - specifies a classname for the element allowing you to apply the style of the predefined class to the content.
<textarea rows="3" cols="30" class="classname"></textarea>
id - specifies a unique id for the element allowing you to apply the style of the predefined id to the content.
<textarea rows="3" cols="30" id="idname"></textarea>
style - specifies an inline style for the element allowing you to apply the style to the content.
<textarea rows="3" cols="30" style="color:red;text-align:left"></textarea>
title - specifies extra information about the content.
<textarea rows="3" cols="30" title="information about the content"></textarea>
Language Attributes
dir - specifies the directional flow of the content.
<!-- The text will flow from left to right -->
<textarea rows="3" cols="30" dir="ltr"></textarea>
<!-- The text will flow from right to left -->
<textarea rows="3" cols="30" dir="rtl"></textarea>
lang - specifies a language code for the content of the element.
<textarea rows="3" cols="30" lang="en"></textarea>
xml:lang - specifies a language code for the content of the element in XHTML documents.
<textarea rows="3" cols="30" xml:lang="fr"></textarea>
Document Event Attributes
NONE
Form Event Attributes
onblur - The JavaScript code to be run when an element loses focus.
<!-- Executes the go() function -->
<textarea rows="3" cols="30" onblur="go()"></textarea>
onchange - The JavaScript code to be run when an element gains focus.
<!-- Executes the go() function -->
<textarea rows="3" cols="30" onchange="go()"></textarea>
onfocus - The JavaScript code to be run when an element loses focus.
<!-- Executes the go() function -->
<textarea rows="3" cols="30" onfocus="go()"></textarea>
onselect - The JavaScript code to be run when an element gains focus.
<!-- Executes the go() function -->
<textarea rows="3" cols="30" onselect="go()"></textarea>
Image Event Attributes
NONE
Keyboard Event Attributes
onkeydown - The JavaScript code to be run when an element is in focus and keyboard key is pressed.
<!-- Executes the go() function -->
<textarea rows="3" cols="30" onkeydown="go()"></textarea>
onkeypress - The JavaScript code to be run when an element is in focus and keyboard key is pressed down and released.
<!-- Executes the go() function -->
<textarea rows="3" cols="30" onkeypress="go()"></textarea>
onkeyup - The JavaScript code to be run when an element is in focus and keyboard key is released.
<!-- Executes the go() function -->
<textarea rows="3" cols="30" onkeyup="go()"></textarea>
Mouse Event Attributes
onclick - The JavaScript code to be run when a mouse is clicked on the element.
<!-- Executes the go() function -->
<textarea rows="3" cols="30" onclick="go()"></textarea>
ondblclick - The JavaScript code to be run when a mouse is double clicked on the element.
<!-- Executes the go() function -->
<textarea rows="3" cols="30" ondblclick="go()"></textarea>
onmousedown - The JavaScript code to be run when the mouse button is pressed down while the cursor is over the element.
<!-- Executes the go() function -->
<textarea rows="3" cols="30" onmousedown="go()"></textarea>
onmousemove - The JavaScript code to be run when the mouse button is moved.
<!-- Executes the go() function -->
<textarea rows="3" cols="30" onmousemove="go()"></textarea>
onmouseout - The JavaScript code to be run when the mouse cursor moves off an element.
<!-- Executes the go() function -->
<textarea rows="3" cols="30" onmouseout="go()"></textarea>
onmouseover - The JavaScript code to be run when the mouse cursor moves over an element.
<!-- Executes the go() function -->
<textarea rows="3" cols="30" onmouseover="go()"></textarea>
onmouseup - The JavaScript code to be run when the mouse button is released while the cursor is over the element.
<!-- Executes the go() function -->
<textarea rows="3" cols="30" onmouseup="go()"></textarea>