Input Password placeholder Attribute
Definition and Usage
placeholder
Set or return the value of the placeholder attribute of the password field.
The HTML placeholder attribute specifies a brief prompt that describes the expected value of the password field (for example, a sample value or a brief description of the expected format).
A brief prompt will be displayed in the password field before the user enters a value.
See also:
HTML Reference Manual:HTML <input> placeholder Atribute
Example
Example 1
Change the placeholder text of the password field:
document.getElementById("myPassword").placeholder = "Please enter your password";
Example 2
Get the placeholder text of the password field:
var x = document.getElementById("myPassword").placeholder;
Syntax
Return placeholder attribute:
passwordObject.placeholder
Set placeholder attribute:
passwordObject.placeholder = text
Attribute Value
Value | Description |
---|---|
text | Specifies a brief hint (word or phrase) describing the expected value of the password field. |
Technical Details
Return Value: | String value, representing a brief hint of the expected value of the password field. |
---|
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | 10.0 | Support | Support | Support |