peterorpete
9/18/2018 - 3:13 PM

.appendChild()

The appendChild() method appends a node as the last child of a node.

var node = document.createElement("LI");                 // Create a <li> node
var textnode = document.createTextNode("Water");         // Create a text node
node.appendChild(textnode);                              // Append the text to <li>
document.getElementById("myList").appendChild(node);     // Append <li> to <ul> with id="myList"