Widely availableUse it when line breaks and longer responses are part of the task, rather than stretching a single-line input beyond its purpose.

Overview

The <textarea> element captures multi-line plain text. It is suited to comments, descriptions, notes, and any field where longer prose input is expected.

Browser support

Feature Desktop Mobile
Chrome
Edge
Firefox
Safari
Chrome Android
Safari iOS
1
12
1
≤4
18
≤3
HTML attribute

The HTML autocomplete attribute lets web developers specify what if any permission the user agent has to provide automated assistance in filling out form field values, as well as guidance to the browser as to the type of information expected in the field.

66
79
59
9.1
66
9.3
cols
1
12
1
≤4
18
≤3.2

The Boolean disabled attribute, when present, makes the element not mutable, focusable, or even submitted with the form. The user can neither edit nor focus on the control, nor its form control descendants.

1
12
1
≤4
18
≤3.2

The form HTML attribute associates a form-associated element with a form element within the same document. This attribute applies to the button, fieldset, input, object, output, select, and textarea elements.

1
12
1
≤4
18
≤3.2

The maxlength attribute defines the maximum string length that the user can enter into an input or textarea. The attribute must have an integer value of 0 or higher.

4
12
4
5
18
4.2

The minlength attribute defines the minimum string length that the user can enter into an input or textarea. The attribute must have an integer value of 0 or higher.

40
17
51
10.1
40
10.3
name
1
12
1
≤4
18
≤3.2

The placeholder attribute defines the text displayed in a form control when the control has no value. The placeholder text should provide a brief hint to the user as to the expected type of data that should be entered into the control.

4
12
4
5
18
5

The Boolean readonly attribute, when present, makes the element not mutable, meaning the user can not edit the control.

1
12
1
≤4
18
≤3.2

The Boolean required attribute, if present, indicates that the user must specify a value for the input before the owning form can be submitted.

4
12
4
5
18
5
rows
1
12
1
≤4
18
≤3.2
wrap
16
12
4
6
18
6
DOM API

The HTMLTextAreaElement interface provides properties and methods for manipulating the layout and presentation of textarea elements.

1
12
1
1
18
1

The autocomplete property of the HTMLTextAreaElement interface indicates whether the value of the control can be automatically completed by the browser. It reflects the element's autocomplete attribute.

66
79
59
9.1
66
9.3

The cols property of the HTMLTextAreaElement interface is a positive integer representing the visible width of the multi-line text control, in average character widths. It reflects the element's cols attribute.

1
12
1
1
18
1

The defaultValue property of the HTMLTextAreaElement interface represents the default text content of this text area. Getting and setting this value is equivalent to getting and setting Node.textContent on the textarea.

1
12
1
1
18
1

The disabled property of the HTMLTextAreaElement interface indicates whether this multi-line text control is disabled and cannot be interacted with. It reflects the textarea element's disabled attribute. When false, this textarea may still be disabled if its containing element, such as a fieldset, is disabled.

1
12
1
1
18
1

The form read-only property of the HTMLTextAreaElement interface returns an HTMLFormElement object that owns this textarea, or null if this textarea is not owned by any form.

1
12
1
1
18
1

The HTMLTextAreaElement.labels read-only property returns a NodeList of the label elements associated with the textArea element.

6
18
56
5.1
18
5

The maxLength property of the HTMLTextAreaElement interface indicates the maximum number of characters (in UTF-16) allowed to be entered for the value of the textarea element, and the maximum number of characters allowed for the value to be valid. It reflects the element's maxlength attribute. -1 means there is no limit on the length of the value.

4
12
4
5
18
5

The minLength property of the HTMLTextAreaElement interface indicates the minimum number of characters (in UTF-16) required for the value of the textarea element to be valid. It reflects the element's minlength attribute. -1 means there is no minimum length requirement.

40
17
51
10.1
40
10.3

The name property of the HTMLTextAreaElement interface indicates the name of the textarea element. It reflects the element's name attribute.

1
12
1
1
18
1

The placeholder property of the HTMLTextAreaElement interface represents a hint to the user of what can be entered in the control. It reflects the textarea element's placeholder attribute.

4
12
4
5
18
5

The readOnly property of the HTMLTextAreaElement interface indicates that the user cannot modify the value of the control. Unlike the HTMLTextAreaElement.disabled attribute, the readonly attribute does not prevent the user from clicking or selecting in the control. It reflects the textarea element's readonly attribute.

1
12
1
1
18
1

The required property of the HTMLTextAreaElement interface specifies that the user must fill in a value before submitting a form. It reflects the textarea element's required attribute.

4
12
4
5
18
5

The rows property of the HTMLTextAreaElement interface is a positive integer representing the visible text lines of the text control. It reflects the element's rows attribute.

1
12
1
1
18
1

The select() method of the HTMLTextAreaElement interface selects the entire contents of the textarea element. In addition, the HTMLTextAreaElement.select_event event is fired. The select() method does not take any parameters and does not return a value.

1
12
1
1
18
1

The select event fires when some text has been selected.

1
12
6
1
18
1

The selectionDirection property of the HTMLTextAreaElement interface specifies the current direction of the selection. The possible values are "forward", "backward", and "none". The forward value indicates the selection was performed in the start-to-end direction of the current locale, with backward indicating the opposite direction. The none value occurs…

15
79
8
6
18
6

The selectionEnd property of the HTMLTextAreaElement interface specifies the end position of the current text selection in a textarea element. It is a number representing the last index of the selected text. It can be used to both retrieve and set the index of the end of a s selected text.

1
12
1
1.3
18
1

The selectionStart property of the HTMLTextAreaElement interface specifies the start position of the current text selection in a textarea element. It is a number representing the beginning index of the selected text. It can be used to both retrieve and set the start of the index of the beginning of a s selected text.

1
12
1
1.3
18
1

The setRangeText() method of the HTMLTextAreaElement interface replaces a range of text in a textarea element with new text passed as the argument.

24
79
27
7
25
7

The setSelectionRange() method of the HTMLTextAreaElement interface sets the start and end positions of the current text selection, and optionally the direction, in a textarea element. This updates the selection state immediately, though the visual highlight only appears when the element is focused. The direction indicates the in which selection should be…

1
12
1
1.3
18
1

The textLength read-only property of the HTMLTextAreaElement interface is a non-negative integer representing the number of characters, in UTF-16, of the textarea element's value. It is a shortcut of accessing String/length on its HTMLTextAreaElement/value property.

4
17
1
5
18
4

The type read-only property of the HTMLTextAreaElement interface returns the string "textarea".

1
12
1
1
18
1

The value property of the HTMLTextAreaElement interface represents the value of the textarea element as a string, which is an empty string if the widget contains no content. It returns or sets the raw value contained in the control.

1
12
1
1
18
1

The wrap property of the HTMLTextAreaElement interface indicates how the control should wrap the value for form submission. It reflects the element's wrap attribute. Note that the "hard" value only has an effect when the HTMLTextAreaElement.cols attribute is also set.

16
12
4
6
18
6
Other
html.elements.textarea.placeholder.line_breaks

Line breaks in `placeholder`

36
12
59
16
36
16
html.elements.textarea.wrap.hard

`hard` value

16
12
18
1+Supported (version) Not supported Has note Sub-feature descriptions sourced from MDN Web Docs (CC BY-SA 2.5)
Notes 3 item(s)
Implementation note
  • Before Firefox 6, when a `<textarea>` was focused, the insertion point was placed at the end of the text by default. Other major browsers place the insertion point at the beginning of the text.
  • A default background-image gradient is applied to all `<textarea>` elements, which can be disabled using `background-image: none`.
  • Before Firefox 89, manipulating the content of `<textarea>` elements using `Document.execCommand()` commands requires workarounds (see bug 1220696).
Notes 1 item(s)
Implementation note
  • Unlike other major browsers, a default style of `opacity: 0.4` is applied to disabled `<textarea>` elements.
Notes 1 item(s)
Implementation note
  • Before Safari 17, newline characters counted as two characters instead of one. See bug 249916.
Notes 1 item(s)
Implementation note
  • Before Safari on iOS 17, newline characters counted as two characters instead of one. See bug 249916.

Syntax

HTML
<label for="comment">Comments:</label>
<textarea id="comment" name="comment"
  rows="4" cols="50"
  placeholder="コメントを入力...">
</textarea>

Live demo

basic textarea

Textarea element in multiple row. Textinput field create.

PreviewFullscreen

Characternumberkaunt with

Maxlength attribute in characternumberlimit settings.

PreviewFullscreen

Read-only / Disabledstate

Readonly and disabled. Difference confirm.

PreviewFullscreen

Use cases

  • Comments and messages

    Collect feedback, support requests, or free-form notes where users need room to explain context.

  • Descriptions and summaries

    Capture bios, task descriptions, and longer content that naturally spans multiple lines.

Cautions

  • Auto-resize behavior and character limits should be intentional so the field remains predictable while users type.
  • Do not hide labels or instructions when the field is expected to hold substantial text.

Accessibility

  • Large text inputs benefit from clear labels, optional length guidance, and visible error messages when limits matter.

Powered by web-features