PDA

View Full Version : How find HEIGHT of DIV when inserted some txt with AJAX and chaged it's size?



mrtrodonet
Jan 4th, 2010, 04:48 AM
Here is the thing.

I need to find the height of the layer but, it's not that simple....

I have a page with div layer where i insert text with innerHTML attribute into it. Depending on the ammount of text i have the HEIGHT of the layer is changing.

if i leave the css part of it with no HEIGHT atribute at all, browser will not automaticaly calculate it and returns empty string on request layerName.style.height

if i assign some value to it("..height: 200px;..") it will not change it after uploading the text. It will change the size but on request layerName.style.height i'll get same 200px.

Please advise...

randomuser773
Jan 4th, 2010, 04:55 AM
I have a page with div layer where i insert text with innerHTML attribute into it. Depending on the ammount of text i have the HEIGHT of the layer is changing.
Just read the div's offsetHeight property.

seco
Jan 4th, 2010, 05:27 AM
height:auto; ?

mrtrodonet
Jan 5th, 2010, 03:51 AM
Thank you, randomuser773!

That was it))