Javascript examples for DOM HTML Element:Button
Button type Property - Change the type of a button to "reset":
<!DOCTYPE html> <html> <body> <form id="myForm" action="#"> First name: <input type="text" name="fname"><br> Last name: <input type="text" name="lname"><br> <button id="myBtn" type="button" value="Reset">Reset</button> </form>//from w w w .ja va 2s . c om <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() { var x = document.getElementById("myBtn").type = "reset"; document.getElementById("demo").innerHTML = "The 'Reset' button now works as it should."; } </script> </body> </html>