Find Scroll Height for elements using jQuery

.Height() method in jQuery returns height of the element but assume an element which has "overflow:auto" property set (you will find scroll bars) and its content are going beyond to the initially defined height. So in such case, jQuery .Height() method will not give you the scroll height.

One need to use scrollHeight property to get height of the scroll view of an element.

If you are using jQuery 1.7 or higher version then use prop(), otherwise use attr(). In the code sample, I have used "prop()" to get value of "scrollHeight" property.
$(document).ready(function() {
  //Get height of the div
  var iHeight = $("#dvContent").height();
  //Get ScrollHeight of the div
  var iScrollHeight = $("#dvContent").prop("scrollHeight");
  var msg = 'Height:' + iHeight + 'px & ScrollHeight:' + iScrollHeight + 'px';

See result below.

See Complete Code
Feel free to contact me for any help related to jQuery, I will gladly help you.

Nothing shocks me, I'm a Software Engineer. And I am not young enough to know everything. I live in World Wide Web and from there take care of this website. This website communicates about my work, learning and experience. I believe life is short, and it is for loving, sharing, learning and connecting. So lets connect..