jQuery get the rendered height of an element?

css, height, javascript, jquery

Solution

It should just be

$('#someDiv').height();

with jQuery. This retrieves the height of the first item in the wrapped set as a number.

Trying to use

.style.height

only works if you have set the property in the first place. Not very useful!

Problem

How do you get the rendered height of an element? Let's say you have a `<div>` element with some content inside. This content inside is going to stretch the height of the `<div>`. How do you get the "rendered" height when you haven't explicitly set the height. Obviously, I tried: ``` var h = document.getElementById('someDiv').style.height; ``` Is there a trick for doing this? I am using jQuery if that helps.

Original source