Search w3schools.com:

SHARE THIS PAGE

Password size Property

Password Object Reference Password Object

Definition and Usage

The size property sets or returns the width of a password field (in number of characters).

The default value is 20.

Syntax

Set the size property:

passwordObject.size=integer

Return the size property:

passwordObject.size


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The size property is supported in all major browsers.


Example

Example

Set the width of the password field:

<html>
<head>
<script>
function setResult()
{
document.getElementById("pwd").size=40;
}
</script>
</head>
<body>

<form>
Password: <input type="password" id="pwd">
</form>

<button type="button" onclick="setResult()">Set width</button>

</body>
</html>

Try it yourself »


Password Object Reference Password Object

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]