English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Reference Manual

HTML Tag Directory

HTML: <textarea> maxlength attribute

The maxlength attribute specifies the maximum length of the text area (in characters). The maxlength attribute is an HTML5 The new attribute of the <textarea> tag in the syntax.

 HTML <textarea> tag

Online Example

A text area with a maximum length of60 characters:

<textarea maxlength="60">
Enter text here...
</textarea>
Test to see ‹/›

Browser Compatibility

IEFirefoxOperaChromeSafari

Internet Explorer 10, Firefox, Chrome, and Safari support the maxlength attribute.

Note:Opera or Internet Explorer 9 and earlier versions do not support the maxlength attribute of the <textarea> tag.

Except for Internet Explorer and Opera, other mainstream browsers support the maxlength attribute.

Definition and Usage

The maxlength attribute specifies the maximum length of the text area (in characters).

HTML 4.01 and HTML5difference between

The maxlength attribute is an HTML5 The new attribute of the <textarea> tag in the syntax.

Syntax

<textarea maxlength="number">

Attribute Value

ValueDescription
numberThe maximum number of characters allowed in the text area.
 HTML <textarea> tag