Rick Joe Rick Joe - 6 months ago 18
Javascript Question

get div height with the scroll? jquery

I need to get a div height, but this height must be the total height, with the scroll content.

for example:

var a = $('#rightinbox').height();
alert(a);


it will give me the div height but not the content inside height.

https://jsfiddle.net/h62vm38a/

How can I get the div inside content height? with the scroll?
thank you friends!

Answer

You can use Element.scrollHeight to get the height including scroll content:

var a = $('#rightinbox')[0].scrollHeight;

or:

var a = $('#rightinbox').prop('scrollHeight');

Fiddle

Comments