HTML DOM maxLength Property
Complete Text Object Reference
Definition and Usage
The maxLength property sets or returns the maximum number of characters in a
text field.
Syntax
textObject.maxLength=number_of_char
|
Example
<html>
<head>
<script type="text/javascript">
function maxLen()
{
alert(document.getElementById("name").maxLength)
}
</script>
</head>
<body>
<form>
Name: <input type="text" id="name" value="Mickey Mouse" size="20"
maxlength="30" />
<br /><br />
<input type="button" onclick="maxLen()" value="Alert maxlength" />
</form>
</body>
</html>
|
Try-It-Yourself Demos
Alert size
and maximum length of a text field
Jump to the
next field when a field's maxlength has been reached
Complete Text Object Reference
|
|
|
See why there are 20,000+ Ektron integrations worldwide.
Request an INSTANT DEMO or download a FREE TRIAL today. |
|
|
|