Name
MAXLENGTH — NN all IE all HTML all
Synopsis
MAXLENGTH=”characterCount"Optional
Defines the maximum number of characters that may be typed into a
text field INPUT element. In practice, browsers
beep or otherwise alert users when a typed character would exceed the
MAXLENGTH value. There is no innate correlation
between the MAXLENGTH and SIZE
attributes. If the MAXLENGTH allows for more
characters than fit within the specified width of the element, the
browser provides horizontal scrolling (albeit awkward for many users)
to allow entry and editing of the field.
Input Types
password, text
Example
<INPUT TYPE="text" NAME="ZIP" MAXLENGTH=10>
Value
Positive integer.
Default
Unlimited.
Object Model Reference
- IE
[window.]document.formName.inputName.maxLength
[window.]document.forms[i].elements[i].maxLength
[window.]document.all.elementID.maxLength
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access