Javascript DOM Element Create
<!DOCTYPE html> <html lang="en"> <body> <script> let newText = document.createTextNode("My Heading"); let newElem = document.createElement("h1"); newElem.appendChild(newText); //from ww w . j a v a 2 s . co m document.body .appendChild(newElem); newText = document.createTextNode("This is some text in a paragraph"); newElem = document.createElement("p"); newElem.appendChild(newText); document.body .appendChild(newElem); </script> </body> </html>