setTimeout(function () {
    document.getElementById('myEl').innerText = 'Hey there, yo!';
}, 0);

var myDiv = document.createElement('div');
myDiv.id = 'myEl';
document.body.appendChild(myDiv);

// setTimeout() buys you some time until the DOM elements are loaded (and rendering is complete), even if it’s set to 0.

// Source: http://benhowdle.im/2013/01/29/settimeout/