Cant get the height of the div in html
Posted
by
user3326265
on Stack Overflow
See other posts from Stack Overflow
or by user3326265
Published on 2014-06-13T09:11:59Z
Indexed on
2014/06/13
9:25 UTC
Read the original article
Hit count: 187
I have assigned the 80% height of the viewport to my div as height. In Button click i have displayed the height of the div. This works fine in ie9, ie10. But in ie7, ie8 $("#divContainer").height() is 0. Am i doing anything wrong and how to get the height of the div in IE7, IE8(vml)
<html style="height:100%;">
<body style="height:100%;">
<div id="divContainer" style="height:100%; border:2px solid #ff0000">
</div>
<button id="button1"></button>
<script type="text/javascript">
$(function () {
$("#button1").click(function()
{
alert($("#divContainer").height());
});
});
</script>
</body>
</html>
Thanks In Advance
© Stack Overflow or respective owner