HTML Input maxlength Attribute

Definition and Usage

The maxlength attribute specifies the maximum number of characters allowed in a input field.
This attribute is only used if the type attribute of the input element is set to "text" or "password".


<input maxlength="characters" />

Syntax Example

<input maxlength="10" />

Attribute Values

Value Description
characters The maximum number of characters allowed in the input field.

Browser Support

The attribute is supported in all major browsers.


<form action="">
<input type="text" name="demo" maxlength="10" />
HTML Input maxlength Attribute Reviewed by 1000sourcecodes on 04:07 Rating: 5
Powered by Blogger.