Jquery find image height not working

beto 10

New Member
I'm trying to use jQuery to find the image height of the first "grand children" of a container, then set the container to that height. But, I can't seem to pull the image height attribute - getting the src works. Any ideas? Is it just trying to pull the heights via CSS? How do i get the "real heights" I can't input the width and height in img tag - so that's not an option ;(\[code\] $(document).ready(function() { var imageContainer = '#image-container'; var imageSrc = http://stackoverflow.com/questions/2150816/$(imageContainer).children(':first').children(':first').attr('src'); // control test var imageHeight = $(imageContainer).children(':first').children(':first').height(); // have also tried attr('height') alert(imageSrc + ' ' + imageHeight); }); <div id="image-gallery"> <div id="image-container"> <div class="slide"> <img src="http://stackoverflow.com/questions/2150816/test1.jpg" alt="test1" /> <p> <strong>This is a test 1</strong> </p> </div> <div class="slide"> <img src="http://stackoverflow.com/questions/2150816/test2.jpg" alt="test2" /> <p> <strong>This is a test 2</strong> </p> </div> </div> </div>\[/code\]
 
Top