Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting div height

Firebug tells me the computed style of my_div:

width 300px

height 453.167px

Yet when I execute console.log(mydiv.style.height), it gives me an empty string, even though console.log(mydiv) logs the correct element. I am sure the page has loaded by the time this logging code is called. I'd appreciate a solution that does not use jQuery.

like image 708
Rose Perrone Avatar asked May 25 '12 00:05

Rose Perrone


1 Answers

Depending on the browser of choice, one of these will do:

mydiv.offsetHeight
mydiv.clientHeight

Get full height of a clipped DIV

Getting the height of a div

like image 127
josh.trow Avatar answered Oct 05 '22 05:10

josh.trow