How to get height of div using jquery in IE
I have a div, i want get height of the div.
$('.graph_container').css('height')
and css is
.graph_container {
width:100%;
float:left;
border:1px solid #CCCCCC;
margin-top:1em;
position:relati开发者_开发百科ve;
}
since height is not mentioned, in IE it give 'auto'. How can i get exacte height.
I appreciate your suggestions.
$('.graph_container').height()
which returns a number.
To calculate height of any element or window or document we can make use of the "height()" method of jQuery.
$(document).ready(function(){
$("p").append($("p").height()+" px");
$("div.divContainer").append($("div.divContainer").height()+" px");
$("div.document").append($(document).height()+" px");
$("div.window").append($(window).height()+" px");
});
<div class="document">Height of this document is: </div>
<div class="window">Height of this window is: </div>
<div class="divContainer">Height of this div container is: </div>
<p>Height of this paragraph is: </p>
精彩评论