get height of nodeList load via ajax with javascript

523 Views Asked by At

I am loading in some html using YUI3, that looks like this:

<div id="content">
  <p>This is all of my content, neat neat neat!!!!</p>
  <img src="ps_logo.png" alt="Google" />
</div>

I've tried using .get('offsetHeight') and .getComputedStyle('height'), but both only return the height of the div and paragraph tag and don't take into account the height of the image. So, even though the image is 150px tall, I am getting 73px returned.

Whats the best way to get the width and height of a nodeList when the elements haven't had it set via CSS?

Thanks for the help.

1

There are 1 best solutions below

0
On

Either set the img height in the img tag - account for it, or ensure that the height query is called after the image has loaded, not just after the image tag has been put in the page.