Javascript examples for DOM HTML Element:Input Email field
Input Email name Property - Change the name of an email field:
<!DOCTYPE html> <html> <body> E-mail: <input type="email" id="myEmail" name="usremail"> <button onclick="display()">Display name</button> <button onclick="change()">Change name</button> <script> function display() { var x = document.getElementById("myEmail").name; console.log("The name of the email field is: " + x); } function change() {//from www . j a va 2 s .c o m var x = document.getElementById("myEmail").name = "newEmailName"; console.log("The name was changed to: " + x); } </script> </body> </html>