Removing an anchor tag surrounding selected images in jquery
<p>I have a piece of code that, when the page loads, checks through a series of images and sees whether their id contains the word video.</p>

<p>If it does, I want to be able to remove the anchor tag surrounding the image. However, teh way that I am currently doing this (through .remove()) removes the image as it is within the anchor tag I'm removing.</p>

<p>Is there a way of just removing the anchor tag?
NOTE: the list of images will be pulled in based on the user accessing them, so it won't be pre-determined code that can be appended in.</p>

<p>CODE:</p>

<pre><code>$(document).ready(function() {
    $('ul.thumbnails li a img').each(function() {
        if($(this).attr('id').indexOf('video') != -1){
            var $parent = $(this).closest('a');
            $parent.remove();
        } else {
            $(this).addClass('photo');
        }
    });
});
</code></pre>
