Search code examples
jqueryimagematchsrc

look for image that has src from a particular site using jQuery


I need to remove all images on a page that has the source from staticflickr.com using jQuery. Could someone please help?

<img class="colorbox-194" src="http://farm8.**staticflickr.com**/7107/7143029237_13d20551a2.jpg" alt="the stride (explore) by stephane (got my camera back!!)">

img like above will be removed.

Thanks.


Solution

  • Try this code:

    $("img").filter(function() {
        return /^https?:\/\/(\w+.)?staticflickr.com\//.test(this.src);
    }).hide();​
    

    DEMO: http://jsfiddle.net/7KbCF/1/