Javascript examples for DOM:Document createElement
Document createElement() Method - Create a button with text:
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <script> function myFunction() {//w w w .ja va 2 s . c o m var btn = document.createElement("BUTTON"); var t = document.createTextNode("CLICK ME"); btn.appendChild(t); document.body.appendChild(btn); } </script> </body> </html>