We can create an <input> element with type="reset" via the document.createElement()
method:
var x = document.createElement("INPUT"); x.setAttribute("type", "reset");
Click the button to create a Reset Button.
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <script> function myFunction() {// ww w .java 2s. c o m var x = document.createElement("INPUT"); x.setAttribute("type", "reset"); document.body.appendChild(x); } </script> </body> </html>