<!DOCTYPE html> <html> <body> <div id="div1"> <p id="p1"> This is a paragraph. </p> <p id="p2">This is another paragraph. </p> </div> <script> var para=document.createElement("h1"); var node=document.createTextNode("This is a new paragraph."); para.appendChild(node); //Put the str in the node into the h1 paragraph//Make it become <h1>This is a new paragraph</h1> var element=document.getElementById("div1"); element.appendChild(para); //Put the para into the div</script> </body> </html>