Getting the .height() of div populated from script

Hello all,
I have this situation where I have a bunch of divs that get populated mostly from templates. My data comes from many sources but I am only having trouble with the div (div3) that has data coming from a script. I am trying to get the height for this div but it seems that theJQuery .height() and the .css(‘height’) get the values after the site has rendered (ready()) but NOT after the script data has returned, therefore I am getting a height of 0 even though there is data coming to populate my div3. The data comes from an external source so I have no control over it. Here is what the code looks like:


<div class="div1">
	...some content
	<div class="div2">data comes from DB</div>
	...some content
	<div class="div3">data comes from script</div>
</div>
<div class="div4">
	..some content
</div>

Any ideashow to get the height for div3? Thanks in advance.

I would recommend you give your div3 element a minimum height that you can use then run an interval to detect when the height has changed and run your script accordingly, see the below example:

var itv = setInterval(function() {
    // Check if the height is greater or less then the original value we set
    if ($('.div3').height() <> 500) {
        clearInterval(itv);
        
        // Do something here...
    }
});