<textarea>

  • Revision slug: HTML/HTML_Elements/textarea
  • Revision title: textarea
  • Revision id: 44969
  • Created:
  • Creator: jswisher
  • Is current revision? No
  • Comment 5 words added, 7 words removed

Revision Content

For the DOM object, see textarea.

The textarea (<textarea>) HTML element represents a multi-line plain text editing control.

Attributes

autofocus
{{ HTMLVersionInline("5") }} This Boolean attribute lets you specify that a form control should have input focus when the page loads, unless the user overrides it, for example by typing in a different control. Only one form-associated element in a document can have this attribute specified. 
cols
The visible width of the text control, in average character widths. If it is specified, it must be a positive integer. {{ HTMLVersionInline("5") }} If it is not specified, the default value is 20.
disabled
This Boolean attribute indicates that the user cannot interact with the control. If this attribute is not specified, the control inherits its setting from the containing element, for example {{HTMLElement("fieldset")}; if there is no containing element with the disabled attribute set, then the control is enabled.
form
{{ HTMLVersionInline("5") }} The form element that the textarea element is associated with (its "form owner"). The value of the attribute must be an ID of a form element in the same document. If this attribute is not specified, the textarea element must be a descendant of a form element. This attribute enables you to place textarea elements anywhere within a document, not just as descendants of their form elements. {{ unimplemented_inline() }}
maxlength
{{ HTMLVersionInline("5") }} The maximum number of characters (Unicode code points) that the user can enter. If it is not specified, the user can enter an unlimited number of characters.
name
The name of the control.
placeholder
{{ HTMLVersionInline("5") }} A hint to the user of what can be entered in the control. The placeholder text must not contain carriage returns or line-feeds.
readonly
This Boolean attribute indicates that the user cannot modify the value of the control. (Unlike the disabled attribute, the readonly attribute does not prevent the user from clicking or selecting in the control.)
required
{{ HTMLVersionInline("5") }} This attribute specifies that the user must fill in a value before submitting a form. {{ unimplemented_inline() }}
rows
The number of visible text lines for the control.
wrap
{{ HTMLVersionInline("5") }} Indicates how the control wraps text. Possible values are:
  • hard: The browser automatically inserts line breaks (CR+LF) so that each line has no more than the width of the control; the cols attribute must be specified.
  • soft: The browser ensures that all line breaks in the value consist of a CR+LF pair, but does not insert any additional line breaks.

If this attribute is not specified, the "soft" behavior is used. {{ unimplemented_inline() }}

Revision Source

<p>For the DOM object, see <a href="/en/DOM/textarea" title="en/DOM/textarea">textarea</a>.</p>
<p>The <em>textarea</em> (&lt;textarea&gt;) HTML element represents a multi-line plain text editing control.</p>
<h2>Attributes</h2>
<dl> <dt> </dt><dt>autofocus</dt> <dd>{{ HTMLVersionInline("5") }} This Boolean attribute lets you specify that a form control should have input focus when the page loads, unless the user overrides it, for example by typing in a different control. Only one form-associated element in a document can have this attribute specified. </dd> <dt>cols</dt> <dd>The visible width of the text control, in average character widths. If it is specified, it must be a positive integer. {{ HTMLVersionInline("5") }} If it is not specified, the default value is 20.</dd> <dt>disabled</dt> <dd>This Boolean attribute indicates that the user cannot interact with the control. If this attribute is not specified, the control inherits its setting from the containing element, for example {{HTMLElement("fieldset")}; if there is no containing element with the <code>disabled</code> attribute set, then the control is enabled.</dd> <dt>form</dt> <dd>{{ HTMLVersionInline("5") }} The form element that the textarea element is associated with (its "form owner"). The value of the attribute must be an ID of a form element in the same document. If this attribute is not specified, the textarea element must be a descendant of a form element. This attribute enables you to place textarea elements anywhere within a document, not just as descendants of their form elements. {{ unimplemented_inline() }}</dd> <dt>maxlength</dt> <dd>{{ HTMLVersionInline("5") }} The maximum number of characters (Unicode code points) that the user can enter. If it is not specified, the user can enter an unlimited number of characters.</dd> <dt>name</dt> <dd>The name of the control.</dd> <dt>placeholder</dt> <dd>{{ HTMLVersionInline("5") }} A hint to the user of what can be entered in the control. The placeholder text must not contain carriage returns or line-feeds.</dd> <dt>readonly</dt> <dd>This Boolean attribute indicates that the user cannot modify the value of the control. (Unlike the <code>disabled</code> attribute, the <code>readonly</code> attribute does not prevent the user from clicking or selecting in the control.)</dd> <dt>required</dt> <dd>{{ HTMLVersionInline("5") }} This attribute specifies that the user must fill in a value before submitting a form. {{ unimplemented_inline() }}</dd> <dt>rows</dt> <dd>The number of visible text lines for the control.</dd> <dt>wrap</dt> <dd>{{ HTMLVersionInline("5") }} Indicates how the control wraps text. Possible values are: <ul> <li><code>hard</code>: The browser automatically inserts line breaks (CR+LF) so that each line has no more than the width of the control; the <code>cols</code> attribute must be specified.</li> <li><code>soft</code>: The browser ensures that all line breaks in the value consist of a CR+LF pair, but does not insert any additional line breaks.</li> </ul> <p>If this attribute is not specified, the "soft" behavior is used. {{ unimplemented_inline() }}</p> </dd>
</dl>
Revert to this revision