Trying to wrap an tag around an image, addClass and input src of img as href of tag:
$(document).ready(function() {
$(".new img").each(function() {
var src = $(this).attr('src').addClass('image');
var a = $('<a/>').attr('href', src);
$(this).wrap(a);
});
});
My HTML:
<img class="new" src="pic0.png" title="Image_Title"/>
Can't seem to get this to work. Any suggestions would be helpful!