Using this code
var html='<div class="somediv"></div>';
var target=document.getElementById('contentArea');
target.appendChild(html);
I’m getting
Uncaught Error: NOT_FOUND_ERR: DOM Exception 8
Uncaught TypeError: Cannot call method 'appendChild' of null
Any suggestion?
In doing DOM operations, before you get a hold of an element, make sure those elements are loaded already. putting the script to the bottom, just before the
</body>tag should door you can run scripts using
window.onload