append child to document code example
Example: how to appendChild in the begin of the div javascript
var element = document.getElementById("div1");
element.insertBefore(para, element.firstChild);
var element = document.getElementById("div1");
element.insertBefore(para, element.firstChild);