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
Get Dynamic HTML: The Definitive Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.