1 //adding 'p' tag to body
2
3 var tag = document.createElement("p"); // <p></p>
4 var text = document.createTextNode("TEST TEXT");
5 tag.appendChild(text); // <p>TEST TEXT</p>
6 var element = document.getElementsByTagName("body")[0];
7 element.appendChild(tag); // <body> <p>TEST TEXT</p> </body>