|Contents||Plain text (including entities)|
|Contained in||Block-level elements, inline elements except BUTTON|
The TEXTAREA element defines a form control for the user to enter multi-line text input. While TEXTAREA is most useful within a FORM, HTML 4 allows TEXTAREA in any block-level or inline element other than BUTTON. However, Netscape 4.x will not display any TEXTAREA elements outside of a FORM.
The initial value of the TEXTAREA is provided as the content of the element and must not contain any HTML tags. When a form is submitted, the current value of any TEXTAREA element within the FORM is sent to the server as a name/value pair. The TEXTAREA element's NAME attribute provides the name used.
The required ROWS and COLS attributes specify the number of visible rows and columns, respectively, in a visual browser. These attributes provide a guide for the user rather than a restriction; browsers allow an unlimited amount of text input in theory, though in practice some browsers limit the contents of a TEXTAREA to 32 or 64 kilobytes. Author restrictions on the amount of data entered should be enforced by the server-side script handling the form.
The boolean READONLY attribute, new in HTML 4.0, prevents the user from editing the content of the TEXTAREA. Read-only elements are still submitted with the form. The DISABLED attribute, also new in HTML 4.0, disables the TEXTAREA. Disabled elements are read-only elements with the added restrictions that the values are not submitted with the form, the elements cannot receive focus, and the elements are skipped when navigating the document by tabbing.
The ACCESSKEY attribute specifies a single Unicode character as a shortcut key for giving focus to the TEXTAREA. Authors can set the access key on the TEXTAREA element or the LABEL element associated with it. Entities (e.g. é) may be used as the ACCESSKEY value.
The TABINDEX attribute specifies a number between 0 and 32767 to indicate the tabbing order of the element. A TEXTAREA with TABINDEX=0 or no TABINDEX attribute will be visited after any elements with a positive TABINDEX. Among positive TABINDEX values, the lower number receives focus first. In the case of a tie, the element appearing first in the HTML document takes precedence.
The TEXTAREA element also takes a number of attributes to specify client-side scripting actions for various events. In addition to the core events common to most elements, TEXTAREA accepts the following event attributes: