//var node holding a Node Object //the node newElement has been created by the createElement method //of the Document Object (cf. infra) node.insertBefore(newElement,node.lastChild); //inserting the new element before the last child element node.replaceChild(newElement,node.firstChild); //replacing the first child element with the new element