Getting the height of a div after setting it to auto in IE
Posted
by Dominic Godin
on Stack Overflow
See other posts from Stack Overflow
or by Dominic Godin
Published on 2010-06-11T12:09:49Z
Indexed on
2010/06/11
12:12 UTC
Read the original article
Hit count: 196
Hi,
I'm writing some JavaScript that changes the size of some content. To do this I need to know the size of a div within my content. If I have the following html:
<div id="wrapper">
... other stuff ...
<div id="inner" style="height:400px">Some text in here</div>
... other stuff ...
</div>
And the following JavaScript:
$('#inner').height('auto');
var height = $("#wrapper").height();
In FireFox and Chrome the height variable increases as the inner div expands to fit all the text. In IE this stays the same. I guess it doesn't redraw the div straight away. Anybody know how to get the new correct height in IE?
Cheers
© Stack Overflow or respective owner