Easy Tutorial
❮ Prop Month Autofocus Prop Node Nextsibling ❯

Password size Attribute


Definition and Usage

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

The default value is 20.

Syntax

Setting the size attribute:

Returning the size attribute:


Browser Support

All major browsers support the size attribute.


Example

Setting the width of the password field:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>tutorialpro.org(tutorialpro.org)</title>
<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>

❮ Prop Month Autofocus Prop Node Nextsibling ❯