I want to replace code on page with real images instead of links to image. I can do that already based on another stackoverflow answer.
But I was wondering if there’s a way to ignore anything that is enclosed in IMG tag.
Thanks!
$("#photos li").each(function() {
$(this).html($(this).html().replace(/(http:\/\/\S+(\.png|\.jpg|\.gif))/g, '<a href="$1" class="fancybox" rel="gallery1"><img src="$1" /></a>'));
});
It looks like the lists contains a set of URLs, not links.
This of course depends on what structure your HTML has.
JSFiddle.