var p = document.createElement("p"); var text = document.createTextNode("This is a new element"); p.appendChild(text); var element = document.getElementById("new"); element.appendChild(p);