<input> - password
HTML DOM Password object
Password object
The Password object represents the password field in the HTML form.
Each time the HTML <input type="password"> tag appears on the form, a Password object is created.
This text input field is for the user to enter some sensitive data, such as passwords, etc. When the user is typing, his input is masked (eg using an asterisk *) to prevent people next to him from seeing the input from behind him. Note, however, that when the form is submitted, the input is sent in clear text.
Similar to elements of type "text", it fires the onchange event handler when the user changes the displayed value.
You can access the password field by iterating over the form's elements[] array, or by using document.getElementById().
Password Object Properties
W3C: W3C standard.
Attribute | Description | W3C |
---|---|---|
defaultValue | Sets or returns the default value for the password field. | Yes |
disabled | Sets or returns whether the Password field should be disabled. | Yes |
form | Returns a reference to the form that contains this password field. | Yes |
maxLength | Sets or returns the maximum number of characters in a password field. | Yes |
name | Sets or returns the name of the password field. | Yes |
readOnly | Sets or returns whether the password field should be read-only. | Yes |
size | Sets or returns the length of the password field. | Yes |
type | Returns the form element type for the password field. | Yes |
value | Sets or returns the value of the value property of the password field. | Yes |
Password object methods
Method | Description | W3C |
---|---|---|
select() | Select the text in the password field. | Yes |
Standard Properties and Events
Password objects also support standard properties and events .