I seem to be having a problem with some code similar to the pseudo-
code below. Assume that I am getting an XML document that has nodes
called "src" that hold image source urls, and that "someDivId" has a
display property of "none" set in the CSS.

- - -

$(function(){

   $.get( "doc.xml", function( data ) {

      $("#someDivId").append( "<img src='" + $("src[0]", data).text()
+ "' />" );
      $("#someDivId img").load(function(){
         $("#someDivId").css("display", "block");
      });

   }

});

- - -

In my code, the DIV is displaying before the image is loaded. However,
if I hard code the image into the HTML, give it an ID, and then attach
the load event to that, it works just fine. Thanks!

Reply via email to