This page is Not Ready

Notice: The WebPlatform project has been discontinued when the Stewards partnership agreement ended in September 2015. This site has been frozen, and the assets we have created will remain.

maxLength

Summary

The maxLength attribute sets an upper limit on the number of characters that can be entered in an input element.

Applies to [html/elements/input](/html/elements/input)
This attribute can be applied to inputs with the type [text](/html/elements/input/type/text), [search](/html/elements/input/type/search), [url](/html/elements/input/type/url), [email](/html/elements/input/type/email), [telephone](/html/elements/input/type/telephone), and [password](/html/elements/input/type/password).

Examples

The example text box has a max length of 12 characters.

<input maxLength="12">

View live example

See also

Related articles

HTML

Attributions