maxlength attribute of the input tag (HTML 4.01)
max chars for text fieldsThe maxlength of the input tag allows you to specify the maximum number of characters to be allowed. For instance, the following textbox only allows 3 characters, because the maxlength attribute has been set to 3:
However, it's up to the clients browser to enforce this restriction, which makes it perfectly possible for a malicious user to circumvent it. Always validate user input.
Example source:
<input type="text" name="textbox" maxlength="3" />
Possible values
| Value |
|---|
| <number> |
maxlength exists in these tags
| Attribute | Deprecated | Description |
|---|---|---|
| input | form control |
© htmlpedia.net 2008 - 2012