I have the following:
<div id="valueboxes" style="overflow-x:hidden;overflow-y:scroll;width:100%;height:200px">
However, every time I use the following:
document.getElementById("valueboxes").innerHTML = html;
I get this error:
'innerHTML': object is null or undefined
Am I doing something wrong?
The html is a table var being appended too by javascript in a for loop using +=.
That's because you are executing your code before DOM is fully loaded.
This should work:
window.onload = function() {
document.getElementById('valueboxes').innerHTML = html;
};
Or you can simply put your javascript code just before </body> tag with no need to use onload there.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With