jQuery jail plugin and image load sometimes does not work
<p>I tried to load images using the jail plugin. It works but sometimes it does not work.</p>

<p>Here is my code:</p>

<pre><code>&lt;script type="text/javascript"&gt;
    $(document).ready(function () {
        //$('img.lazy').jail({
        $("table[id*=dgImages] img").jail({
            //callbackAfterEachImage: function () {},
            //callback: (function () { alert("All the images are loaded"); })
        });
    });
&lt;/script&gt;

&lt;asp:DataList ID="dgImages" runat="server" RepeatColumns="4" RepeatDirection="Horizontal" RepeatLayout="Table" CellPadding="1"&gt;
    &lt;ItemTemplate&gt;
        &lt;div class="BusyStyles&gt;
            &lt;asp:Image CssClass="lazy" runat="server" id="Image1"  data-href='&lt;%# Eval("photos") %&gt;' BorderWidth="0" alt="" style="width:300px;height:300px;"/&gt;
            &lt;noscript&gt;&lt;img class="nolazy" src='&lt;%# Eval("photos") %&gt;' border='0' width="300px" height="300px"/&gt;&lt;/noscript&gt;
        &lt;/div&gt;
    &lt;/ItemTemplate&gt;
&lt;/asp:DataList&gt;
</code></pre>

<p>When i load images with the syntax like, it works:</p>

<pre><code>$(document).ready(function () {
    $('img.lazy').jail({
        //callbackAfterEachImage: function () {},
        //callback: (function () { alert("All the images are loaded"); })
    });
});
</code></pre>

<p>But when I try to load images like this, It does not work, I cannot understand why:</p>

<pre><code>$(document).ready(function () {
    $("table[id*=dgImages] img").jail({
        //callbackAfterEachImage: function () {},
        //callback: (function () { alert("All the images are loaded"); })
    });
});
</code></pre>

<p>This plugin also has a callback function which is called when each image loaded. I want to know who the immediate parent of the loading image is. Each image is wrapped in a div so div will be parent. Show me a way, from <code>callbackAfterEachImage</code> callback, for getting the reference of immediate parent of the loading image.</p>

<p>As a result I can work with that immediate parent.</p>
