Javascript examples for DOM HTML Element:Input Password
Input Password name Property - Change the name of a password field:
<!DOCTYPE html> <html> <body> <form> Password: <input type="password" id="myPsw" name="pw"> </form>//from w w w. j av a 2s .c o m <button onclick="display()">Display name</button> <button onclick="change()">Change name</button> <script> function display() { var x = document.getElementById("myPsw").name; console.log("The name of the password field is: " + x); } function change() { var x = document.getElementById("myPsw").name = "newPasswordName"; console.log("The name was changed to: " + x); } </script> </body> </html>