MAXLENGTH Attribute | maxLength Property

Internet Development Index

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

Syntax

HTML<ELEMENT MAXLENGTH = iLength... >
Scriptingobject.maxLength(v) [ = iLength ]

Possible Values

iLengthInteger that specifies or receives the maximum length of the input.

The property is read/write. The property has no default value.

Expressions can be used in place of the preceding value(s), as of Microsoft® Internet Explorer 5. For more information, see About Dynamic Properties.

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.

Standards Information

This property is defined in HTML 3.2 Non-Microsoft link and is defined in World Wide Web Consortium (W3C) Document Object Model (DOM) Level 1 Non-Microsoft link.

Applies To

INPUT type=text, INPUT type=password

See Also

size