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?
Asked
Active
Viewed 2,383 times
3
3 Answers
2
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,744
- 13
- 44
- 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,050
- 1
- 16
- 12
document.getElementById('your divid').height()– veena s kurup Oct 25 '13 at 05:08