How do you get the rendered height of an element?
Let\'s say you have a
You can use .outerHeight()
for this purpose.
It will give you full rendered height of the element. Also, you don't need to set any css-height
of the element. For precaution you can keep its height auto so it can be rendered as per content's height.
//if you need height of div excluding margin/padding/border
$('#someDiv').height();
//if you need height of div with padding but without border + margin
$('#someDiv').innerHeight();
// if you need height of div including padding and border
$('#someDiv').outerHeight();
//and at last for including border + margin + padding, can use
$('#someDiv').outerHeight(true);
For a clear view of these function you can go for jQuery's site or a detailed post here.
it will clear the difference between .height()
/ innerHeight()
/ outerHeight()