Input Password size Attribute
Definition and Usage
size
Sets or returns the size attribute of the password field.
The HTML size attribute specifies the width of the password field (in number of characters).
The default value is 20.
Tip:To set or return the maximum number of allowed characters in the password field, use maxLength Attribute.
See also:
HTML Reference Manual:HTML <input> size Attribute
Example
Example 1
Change the width of the password field:
document.getElementById("myPsw").size = "50";
Example 2
Get the width of the password field:
var x = document.getElementById("myPsw").size;
Syntax
Return the size attribute:
passwordObject.size
Set the size attribute:
passwordObject.size = number
Attribute Value
Value | Description |
---|---|
number | Specifies the width of the password field in characters. The default value is 20. |
Technical Details
Return Value: | Number, representing the width of the password field in characters. |
---|
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | 10.0 | Support | Support | Support |