Javascript examples for DOM:Element appendChild
Use appendChild function to add text node
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> </head> <body> <script type="text/javascript"> function append()//from w w w.j a v a2 s. c o m { var node = document.getElementById("history"); node.appendChild(document.createTextNode("text")); } window.onload = append; </script> <div id="history"></div> </body> </html>