Javascript examples for DOM HTML Element:Input Password
Input Password value Property - Change the value of the password field:
<!DOCTYPE html> <html> <body> <form> Password: <input type="password" id="myPsw"> </form>/*from w ww. ja va2s. c om*/ <button onclick="display()">Display value</button> <button onclick="change()">Change value</button> <script> function display() { var x = document.getElementById("myPsw").value; console.log("The value of the password field is: " + x); } function change() { var x = document.getElementById("myPsw").value = "NewPassword123"; console.log("The value was changed to: " + x); } </script> </body> </html>