HTML DOM PasswordObject
Password Object
The Password object represents a password field in an HTML form.
Each time the HTML <input type="password"> tag appears in a form, a Password object is created.
This text input field is for users to enter sensitive data such as passwords. When the user types, the input is masked (e.g., with asterisks *) to prevent people behind from seeing what is entered. However, note that when the form is submitted, the input is sent in plain text.
Similar to elements of type "text", it triggers the onchange event handler when the user changes the displayed value.
You can access the password field by iterating through the form's elements[] array, or by using document.getElementById().
Password Object Properties
W3C:W3C Standard.
| Property | Description | W3C |
|---|---|---|
| defaultValue | Sets or returns the default value of 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 the 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 of the password field. | Yes |
| value | Sets or returns the value of the value attribute of the password field. | Yes |
Password Object Methods
| Method | Description | W3C |
|---|---|---|
| select() | Selects the text in the password field. | Yes |
Standard Properties and Events
The Password object also supports the standardPropertiesandEvents。
Other Extensions