HTML <textarea> maxlengthAttribute

HTML textarea 标签参考手册HTML <textarea> tag

Example

A text area with a maximum length of 50 characters:

<textarea maxlength="50">
Enter content...
</textarea>

Try it yourself »

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

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, all other major browsers support the maxlength attribute.


Definition and Usage

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


Difference between HTML 4.01 and HTML5

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


Syntax

<textarea maxlength="number">

Attribute Values

Value Description
number The maximum number of characters allowed in the text area.


HTML textarea 标签参考手册HTML <textarea> tag Other Extensions