I am attempting to get the height of an element on a page. I get the expected value (700px or so) in FF and Webkit on Mac, but I am getting a value of 0 in IE8. I haven't tried earlier versions of IE yet.
html:
<section>
<article>
...
</article>
javascript:
var height = myElement.outerHeight(true);
There are a number of things that could be complicating this.
- I'm trying to measure the element immediately after it is dynamically added to the page (the element is added as the result of an ajax request),
- the element I am trying to measure is an html5 element (section).
One thing I've noticed is that the inserted html5 elements are poorly formatted when viewed using developer tools. I get things like </article/>
. Anything that was part of the page when it loaded looks fine.
Some things I've tried in attempting to solve the problem:
- I've added css to apply display:block to all html5 elements
- I've added Remy Sharp's "html5 enabling script" (http://remysharp.com/2009/01/07/html5-enabling-script/)
- I'm using
- I've tried using all divs instead of html5 elements
myElement.height()
returns a value of 'auto' in IE8 whereas in other browsers I get a pixel value.innerHeight()
returnsnull
.
Thanks