HTML DOM maxLength Property
Complete Password Object Reference
Definition and Usage
The maxLength property sets or returns the maximum number of characters
allowed in
a password field.
Syntax
passwordObject.maxLength=number_of_chars
|
Example
The following example alerts the maximum number of characters allowed in the
specified password field:
<html>
<head>
<script type="text/javascript">
function alertLength()
{
alert(document.getElementById("password1").maxLength)
}
</script>
</head>
<body>
<form>
<input type="password" id="password1" maxLength="8" />
<input type="button" id="button1" onclick="alertLength()"
value="Alert maxLength" />
</form>
</body>
</html>
|
Try-It-Yourself Demos
Get the max number of characters allowed in the password field
Complete Password Object Reference
|