I have a function that gets the contents of a table row and displays each cells content in a different part of the page. This works great, but I need to remove a class from an image which is inside an a tag. The variable looks like this:
var bilde=$('span[id^="foto"]', this).find('a').html();
And is outputed to the other part of the page like this:
$('.bilde').html(bilde);
When I use firebug, i see that the contents of .bilde is outputted like this:
<div class="bilde">
<img id="foto2" class="previewImage" src="images/upload/thumb/516467.jpg">
</div>
How can I remove the class “previewImage” from that image, but ONLY from the image that is displayed inside “.bilde”. I’ve played around the the .removeClass, but with no result.
Try –
Demo – http://jsfiddle.net/D5APn/