Meaningless Drivel is fun!
The moose likes HTML, CSS and JavaScript and the fly likes Finding total lenght of DIV Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Finding total lenght of DIV" Watch "Finding total lenght of DIV" New topic

Finding total lenght of DIV

Rizwan Mohammad
Ranch Hand

Joined: Sep 02, 2005
Posts: 445
I would like to know the total scrollable area available in my <div> using java script. How do i do that?
The followign code gives only the lenght of div tag area(say 100px)

But there can be more content inside div with scorllbar appearance..say 300px(not sure how much) of content...How do i know the total content lenght.
This i need to know so that I can set the scrollbar to the bottom(as this is my requirement).. Right now I have set the highest value to work..

Is this the way to code? or Is there way to know the exact height of scrollable div area?

Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385

Rizwan Mohammad
Ranch Hand

Joined: Sep 02, 2005
Posts: 445
This works great. Thanks Eric.
It is sorta covered in the JavaRanch Style Guide.
subject: Finding total lenght of DIV
jQuery in Action, 3rd edition