Why does this not work?
Using vanilla JavaScript to set the style on body tag?
test
&l
I used the following solution:
<script>
function changeDisplay(){
document.body.style.display = 'block';
}
setTimeout(function () { changeDisplay(); }, 0);
</script>
If you want the body
tag you can simply use document.body
. See the demo: http://jsfiddle.net/TH3Yd/
Because getElementsByTagName() returns a NodeList, not a single element. Treat it as array:
document.getElementsByTagName("body")[0].style.display = "block";
Or even simpler in case of body
:
document.body.style.display = "block";