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?

Arun CH
  • 101
  • 1
  • 12
  • Do you know after which event the height of the div increasing? If you know, use the script document.getElementById('your divid').height() – veena s kurup Oct 25 '13 at 05:08

3 Answers3

2

This might help you

document.getElementById("div1").clientHeight

Arjun Shetty
  • 1,575
  • 1
  • 15
  • 36
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.

KarSho
  • 5,699
  • 13
  • 45
  • 78
-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.

N20084753
  • 2,130
  • 2
  • 17
  • 12