HTML DOM Password defaultValue property
Definition and Usage
defaultValue property sets or returns the default value of the password field.
Note: The default value is the default value specified in the HTML "value" attribute.
grammar
Setting defaultValue property:
passwordObject.defaultValue="value"
Back defaultValue attributes:
passwordObject.defaultValue
Browser Support
All major browsers support defaultValue property
Examples
Examples
The following examples available Default password fields:
<! DOCTYPE html>
<Html>
<Head>
<Meta charset = "utf-8">
<Script>
function displayResult () {
var x = document.getElementById ( "pwd") defaultValue.;
alert (x);
}
</ Script>
</ Head>
<Body>
<Form>
Password: <input type = "password" id = "pwd" value = "thgrt456">
</ Form>
<Button type = "button" onclick = "displayResult ()"> displays the default value </ button>
</ Body>
</ Html>
<Html>
<Head>
<Meta charset = "utf-8">
<Script>
function displayResult () {
var x = document.getElementById ( "pwd") defaultValue.;
alert (x);
}
</ Script>
</ Head>
<Body>
<Form>
Password: <input type = "password" id = "pwd" value = "thgrt456">
</ Form>
<Button type = "button" onclick = "displayResult ()"> displays the default value </ button>
</ Body>
</ Html>
try it"
Password objects