How to get height of the highest children element in javascript/jQuery?
dom, height, javascript, jquery
Solution
You could always do:
var t=0; // the height of the highest element (after the function runs)
var t_elem; // the highest element (after the function runs)
$("*",elem).each(function () {
$this = $(this);
if ( $this.outerHeight() > t ) {
t_elem=this;
t=$this.outerHeight();
}
});
Edited to make it work again.
Problem
I need a function to get the height of the highest element inside a div. I have an element with many others inside (dynamically generated), and when I ask for the height of the container element using $(elem).height(), I get a smaller height than some of the contents inside it. Some of the elements inside are images that are bigger than the size this element says to have. I need to know the highest element so I can get it's height.