Password defaultValue property

HTML DOM Password defaultValue property The Password object

Definitions and usages

The defaultValue property sets or returns the default value for the password domain.

Note: This default value is the default value specified in the HTML "value" property.

Grammar

Set the defaultValue property:

passwordObject.defaultValue=" value "

Returns the defaultValue property:

passwordObject.defaultValue


Browser support

HTML DOM Password defaultValue property HTML DOM Password defaultValue property HTML DOM Password defaultValue property HTML DOM Password defaultValue property HTML DOM Password defaultValue property

The defaultValue property is supported by all major browsers


Here's an example to get the default value for a password domain:

<! DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script>
function displayResult(){
var x=document.getElementById("pwd").defaultValue;
alert(x);
}
</script>
</head>
<body>

<form>
Password: slt;input type-"password" id="pwd" value="thgrt456";"
</form>
"button" onclick" "displayResult()"

</body>
</html>

Try it out . . .


HTML DOM Password defaultValue property The Password object