Javascript examples for DOM HTML Element:Input Reset
Input Reset name Property - Change the value of the name attribute of a Reset button:
<!DOCTYPE html> <html> <body> <form> First name: <input type="text" name="fname"> <input type="reset" name="reset1" id="myReset"> </form>/*from w w w.j av a 2s. com*/ <button onclick="display()">Display name</button> <button onclick="change()">Change name</button> <script> function display() { var x = document.getElementById("myReset").name; console.log("The name of the Reset button is: " + x); } function change() { var x = document.getElementById("myReset").name = "newName"; console.log("The name was changed to: " + x); } </script> </body> </html>