Input Password placeholder Property - Get the placeholder text of a password field: - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Password

Description

Input Password placeholder Property - Get the placeholder text of a password field:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>
Password: <input type="password" id="myPsw" placeholder="Your password">

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

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

<script>
function myFunction() {/*w w w.java2  s .  c om*/
    var x = document.getElementById("myPsw").placeholder;
    document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

Related Tutorials