javascript append li code example
Example 1: append li to ul javascript
function function1() {
var ul = document.getElementById("list");
var li = document.createElement("li");
li.appendChild(document.createTextNode("Four"));
ul.appendChild(li);
}
Example 2: add a child html object to another html object in js
//Add child at end of object children list
parent.append(child);
//Add child at start of object children list
parent.insertBefore(child, list.childNodes[0]);