textarea

FilterElements

<textarea> ... </textarea>

Defines a multiline text entry control. The content of the textarea element is displayed in the text entry field when the form initially displays.

Start/End Tags

Required/Required

Specifications

  • HTML 4.01
  • HTML5

autofocus

Values: None in HTML. (autofocus="autofocus" in XHTML)
HTML5 only. Indicates the control should have focus (be highlighted and ready for user input) when the document loads.

cols=

Values: number
Required. Specifies the visible width of the text entry field, measured in number of characters. Users may enter text lines that are longer than the provided width, in which case the entry scrolls to the right (or wraps if the browser provides some mechanism for doing so).

disabled

Values: None in HTML. (disabled="disabled" in XHTML)
Disables the control for user input. It can be altered only via a script. Browsers may display disabled controls differently (grayed out, for example), which could be useful for dimming certain controls until required info is supplied.

form=

Values: id of form owner
HTML5 only. Explicitly associates the input control with its associated form (its form owner). With this method, the input control does not need to be a child of the form element that applies to it.

maxlength=

Values: number
HTML5 only. Specifies the maximum number of characters the user can input for a text or password input element.

name=

Values: text
Required. Specifies a name for the text input control. This name will be sent along with the control content to the form-processing application.

placeholder=

Values: number
HTML5 only. Provides a short (one word or short phrase) hint or example to help the user enter the correct data. If a longer description is necessary, use the title attribute.

readonly

Values: None in HTML. (readonly="readonly" in XHTML)
Indicates that the form control may not be modified.

required

Values: None in HTML. (required="required" in XHTML)
HTML5 only. When present, indicates the input data is required.

rows=

Values: number
Required. Specifies the height of the text entry field in number of lines of text. If the user enters more lines than are visible, the text field scrolls down to accommodate the extra lines.

wrap=

Values: hard | soft
HTML5 only. When set to hard, hard returns (carriage return + line feed characters) are inserted at the end of lines as they appear in text entry field. When set to hard, there must also be a cols attribute specifying the length of the line. When set to soft (the default), line breaks in the text entry field are not preserved in the returned data.
<p>What did you dream last night?</p>
<textarea name="dream" rows="4" cols="45">Tell us your dream in 100 words or fewer.</textarea>

Rendered Example

What did you dream last night?