Signup/Sign In
Ask Question
Not satisfied by the Answer? Still looking for a better solution?

JQuery get the rendered height of an element?

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.
by

1 Answer

akshay1995
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!

Login / Signup to Answer the Question.