What\'s the difference between:
var div = document.createElement(\'div\');//output -> [object HTMLDivElement]
document.getElementById(\'container\').appe
appendChild really does expect a HTMLDomNode of some kind, such as a HTMLDivElement, and not a string. It doesn't know how to deal with a string. You could do
document.getElementById('container').innerHTML += div;
but I really prefer the first version; and I'd rely more on it to behave the same across browsers.