Javascript examples for DOM HTML Element:Input Submit
Input Submit name Property - Change the value of the name attribute of a Submit button:
<!DOCTYPE html> <html> <body> <input type="submit" name="submit1" id="mySubmit"> <button onclick="display()">Display name</button> <button onclick="change()">Change name</button> <script> function display() { var x = document.getElementById("mySubmit").name; console.log("The name of the Submit button is: " + x); } function change() {/*from w w w .j a v a2 s.c o m*/ var x = document.getElementById("mySubmit").name = "newName"; console.log("The name was changed to: " + x); } </script> </body> </html>