Using jQuery iterate in images inside div and change their src and also add one new attribute
<p>each div has one image having fixed class. i need to change all images src inside those div which has class called ".<strong>diagnostic_picture</strong>" using jquery and also add one new attribute to all the images called "<strong>delaySrc</strong>" inside that div having class called ".diagnostic_picture". here this way wrote the code but did not work....can anyone help me. thanks</p>

<pre><code>&lt;div class="diagnostic_picture"&gt;&lt;img src="test1.gif" /&gt;&lt;/div&gt;
&lt;div class="diagnostic_picture"&gt;&lt;img src="test2.gif" /&gt;&lt;/div&gt;
&lt;div class="diagnostic_picture"&gt;&lt;img src="test3.gif" /&gt;&lt;/div&gt;

 $(document).ready(function () {
        $(".diagnostic_picture").each(function () {
            $(this).children("img")
            .attr("src", 'images/ajax-loader.gif')       // this way i change the src
            .attr('delaySrc', $this.attr("src")); ;      // this way i add new attribute
        });
    });
</code></pre>

<p>the attribute called <strong>delaySrc</strong> not being added to img tag inside the div so i change the code bit but still new attribute not being added....i check source by firebug.</p>

<h2>change code</h2>

<pre><code>  $(".diagnostic_picture img").each(function () {
        var img = $(this);
        img.attr("delaySrc", function () { img.attr("src") })
        img.attr("src", 'images/ajax-loader.gif');
    });
</code></pre>
