all
alt
ch
dir
id
min
rel
top
url
URL
urn
Expand Minimize

maxlength attribute | maxLength property

Sets or retrieves the maximum number of characters that the user can enter in a text control.

HTML 4.01 Specification, Section 17.4HTML5 A vocabulary and associated APIs for HTML and XHTML, Section 4.10.7.3.8

Syntax

HTML<element maxlength="p" ... >
JavaScript

p = object.maxLength

Property values

Type: Integer

The maximum length of the input.

Standards information

Remarks

The maxLength property limits the number of characters the user can enter. The property does not limit programmatic assignments to the value property. The property's value can be larger than the size of the text box, in which case the text box scrolls as the user types.

See also

HTMLInputElement
HTMLTextAreaElement
input type=email
input type=number
input type=password
input type=range
input type=search
input type=tel
input type=text
input type=url
size

 

 

Show:
© 2014 Microsoft. All rights reserved.