1
2 var para = document.createElement("P"); // Create a <p> node
3var t = document.createTextNode("This is a paragraph."); // Create a text node
4para.appendChild(t); // Append the text to <p>
5
6 document.getElementById("myDIV").appendChild(para); // Append <p> to <div> with id="myDIV"