You are here: Reference > HTML > attributes > maxLength (input, isindex)
maxLength attribute (input, isindex)
Sets the maximum number of characters allowed in a text box.
If the maximum number of characters is reached, the user cannot add more characters to the contents of the input element.
Integer that sets the maximum length of text, in characters. Zero and negative integers mean that no characters can be entered into the input box.
Default: this attribute has no default value.
Example HTML code 1:
This example illustrates the use of the maxLength attribute:
<input type="text" maxlength="4" size="20" />
Did you find this example helpful?
Supported by tags:
User Contributed Comments