Credit Cards - Become hacker - Valentine Gifts For Him - Free Advertising - Debt Consolidation

PDA

View Full Version : Can I get the height of a div that can grow depending of its content?


+:::Spider25:::+
Aug 19th 2006, 4:46 pm
Hey guys,
I see this problem a kind of difficult to be solved.
I have a Div that can grow with comments that the posters add, I have to know what is the height of this div (ex. 120px or 500px.) this will be when the after the grow action of course.
I need that data pals.

Thanxs a lot
;)

Neoto
Aug 20th 2006, 12:52 am
Hi,

I think it's impossible to say what the height will be before adding comments. But you can always check the current height from scrollHeight and try to predict from that.

To get the current height, use something like this:

var height = document.getElementById("id_of_the_element_to_check").scrollHeight;

Neoto

+:::Spider25:::+
Sep 5th 2006, 8:56 am
Ok I will try...
Thanks