Input Password defaultValue Property - Return the default value of a password field: - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Password

Description

Input Password defaultValue Property - Return the default value of a password field:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>
Password: <input type="password" id="myPsw" value="mypwd345">

<button type="button" onclick="myFunction()">Test</button>

<p id="demo"></p>

<script>
function myFunction() {//from  w w  w .j a v  a  2 s .c o  m
    var x = document.getElementById("myPsw");
    var defaultVal = x.defaultValue;
    document.getElementById("demo").innerHTML = defaultVal;
}
</script>

</body>
</html>

Related Tutorials