Definition and Usage The maxlength attribute specifies the maximum number of characters allowed in a input field. This attribute is only u...
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".
Syntax
<input maxlength="characters" /> |
Syntax Example
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.
Example
<form action="">
<input type="text" name="demo" maxlength="10" />
</form> |