JavaScript Reference/Javascript Properties/maxLength
"maxLength" Example
<html>
<body>
<input type="password" id="myText">
<script language="JavaScript">
document.getElementById("myText").maxLength = 10;
</script>
</body>
</html>
"maxLength" is applied to
+----------------+--------------------------------------------------------------+
| Applied_To |<input type="password"> <input type="text"> |
+----------------+--------------------------------------------------------------+
"maxLength" Syntax and Note
Note:
Read and write property.
Sets the maximum number of characters that can fit into the text field.
Syntax:
document.getElementById("inputID").maxLength = value
document.all.inputID.maxLength = value // IE only