Any reason why this javascript won't run?
<script>
alert(window.screen.availHeight+"px");
var height = window.screen.availHeight + “px”;
document.getElementsByClassName(“col-sm-9”).style.height = height;
</script>
Any reason why this javascript won't run?
<script>
alert(window.screen.availHeight+"px");
var height = window.screen.availHeight + “px”;
document.getElementsByClassName(“col-sm-9”).style.height = height;
</script>
document.getElementsByClassName('col-sm-9').style.height
the getElementsByClassName method returns an array. (hint: Elements not element)
You either need to select the first element:
document.getElementsByClassName('col-sm-9')[0].style.height = height
Or iterate though the array e.g:
for(var i=0; i<document.getElementsByClassName('col-sm-9').length; i++)
{
document.getElementsByClassName('col-sm-9')[i].style.height = height;
}