Javascript examples for DOM HTML Element:Input Button
Create button element and its content as text node
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> </head> <body onload="createButton()"> <script> function createButton(){/*ww w .java 2 s . c o m*/ var newButton = document.createElement("button"); newButton.onclick = function() { document.write('test') }; var textButton = document.createTextNode("new Node"); newButton.appendChild(textButton); document.body.appendChild(newButton); } </script> </body> </html>