Javascript examples for DOM HTML Element:Input Button
You can create a <input type='button'> element by using the document.createElement() method:
<!DOCTYPE html> <html> <body> <p>Click the "Try it" button to create a BUTTON element with a "Click me" text.</p> <button onclick="myFunction()">Test</button> <script> function myFunction() {/* w ww .j a v a2s. c om*/ var x = document.createElement("INPUT"); x.setAttribute("type","button"); x.setAttribute("value","asdf"); document.body.appendChild(x); } </script> </body> </html>