through jquery code i tried to add a new attribute called delaySrc to img tag and try to change the value of src attribute to all img tag inside in div.
<div class="diagnostic_picture"><img src="test1.gif" /></div>
<div class="diagnostic_picture"><img src="test2.gif" /></div>
<div class="diagnostic_picture"><img src="test3.gif" /></div>
$(".diagnostic_picture img").each(function () {
var img = $(this);
img.attr("delaySrc", function () { img.attr("src") })
img.attr("src", 'images/ajax-loader.gif');
});
src attribute value is getting change but new attribute is not going to add to all img tag in div. please suggest me where i am wrong. what to change in code. thanks