jquery to display images on divs
<p>I am posting here again, I cannot seem to find a solution for this problem. I am using jquery and jstree plugin to build a tree and based on the node_id of the jstree, I am showing some images on divs. The problem I am facing is that some images are not loading eventhough they are there. When I experienced this problem, I verified that the image in question actually not loading by checking the width of the image. Below is the code. How can I make sure to load image before displaying it. Again, any help with this greatly appreciated as I am very new to jquery:</p>

<pre><code>(document).ready(function () {
    $("#div1").jstree({
        "xml_data": {
            "ajax": {
                "url": "tree.xml"
            },
            "xsl": "nest"
        },
        "plugins": ["themes", "xml_data", "ui", "types"]
    }).bind("select_node.jstree", function (event, data) {
        var node_id = data.rslt.obj.attr("id");
        if (node_id.indexOf("TEAM") &gt;= 0) var teamA;
        var teamB;
        teamA = "image/" + node_id + "-scores.png";
        teamB = "image/" + node_id + "-standing.png";
        img1 = new Image;
        img1.src = teamA;
        img2 = new Image;
        img2.src = teamB;
        $("#div2").html(img1);
        $("#div3").html(img2);
    });
</code></pre>
