I\'m trying to remove the loaded image from a element, but clearing or removing the src doesn\'t do it. What to do?
HTML:
This worked for me:
var $image = $('.my-image-selector');
$image.removeAttr('src').replaceWith($image.clone());
However, be wary of any event handlers that you might have attached to the image. There's always the withDataAndEvents and deepWithDataAndEvents options for jQuery clone, but I haven't tested the code with them: http://api.jquery.com/clone/#clone-withDataAndEvents
Also, if you want to do this for multiple images, you will probably have to use something like jQuery each.
I posted an identical answer on a similar question: Setting image src attribute not working in Chrome