You are here: Reference > HTML > attributes > maxLength (input, isindex)

maxLength attribute (input, isindex)

Browser support:
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.
JavaScript page for this attribute: maxLength. You can find other example(s) there.

Possible values:

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? yes no

Supported by tags:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content