3

Is there anyway to get the height of a dynamic div using javascript?I have a dynamic div which is populated by contents dynamically.I want to know div's height each time. Can anybody help me to figure it out?

1
  • Do you know after which event the height of the div increasing? If you know, use the script <code>document.getElementById('your divid').height() Commented Oct 25, 2013 at 5:08

3 Answers 3

2

See this Fiddle.

You can set/get the Height of DIV from height Property

Example Code is,

document.getElementById("demo").style.height; document.getElementById("demo").style.height="100px"; 

If you set height in CSS means, use JQuery.

Sign up to request clarification or add additional context in comments.

Comments

2

This might help you

document.getElementById("div1").clientHeight

Comments

-1

You can use .height(), .innerHeight() or outerHeight() based on what you need.

.height() - returns the height of element excludes padding, border and margin.

.innerHeight() - returns the height of element includes padding but excludes border and margin.

.outerHeight() - returns the height of the div including border but excludes margin.

.outerHeight(true) - returns the height of the div including margin.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.