Hello folks,
This piece of code
if (($('#theImage').length>0)) {
var img_width = $('#theImage').width();
$.log(img_width);
$("#sCaption").css("width",img_width);
};
follows an ajax call to bring content to an existing div...
$.get("scripts/ajax_ramosus_client_second.asp?brm="+ej +"&q=" +
new Date().getTime(), function(responseText){
$("#wrapper").html(responseText);
I don't understand why the width is always being reported as 0.
The relevant portion of the HTML being returned is...
<img src="images/ramosus/dicentra/dicentra1.jpg" id="theImage"
class="pad5" alt=""><div id="sCaption" style="width: 0pt;"><br>Lorem
ipsum dolor sit amet, consectetuer adipiscing elit. Duis in ipsum.
Donec faucibus sodales lacus?</div>
Any ideas?
Is it, perhaps, that if the image hasn't loaded before the code is
processed, then the width of theImage will be 0. If so, how do I
code around this issue?
Thanks,
Bruce