bellatrix
bellatrix

Reputation: 21

removing images by specific domain

I am parsing an RSS feed that has images. Unfortunately, the feed's contents also contain unneccessary 1px x 1px gif images and when I apply css float, margins and padding to the images in the feed, this is also applied to the phantom spacer image upsetting the layout. All of these images originate from feedburner.com. So i am trying to add a class to those images to remove them from the document flow using the following:

$(function(){
  $('img[src*="feedburner.com"]').each(function(){
    $(this).addClass('remove');
  }
});

This is an actual sample image link:

<img src="http://feeds.feedburner.com/~r/somefeedslink/~4/C5PbADF9rxo" height="1" width="1">

Am I doing something wrong? I've tried several methods but this seems to be the most likely method to isolate these images from the rest. Appreciate any help on this. Thanks

Upvotes: 0

Views: 145

Answers (3)

Malk
Malk

Reputation: 11983

$('img[src*="feedburner.com"]').remove();

Upvotes: 0

grc
grc

Reputation: 23575

I tried this and it worked for me. You're just forgot to close a bracket.

$(function(){
    $('img[src*="feedburner.com"]').each(function(){
        $(this).addClass('remove');
    });
});

Upvotes: 1

Rahul
Rahul

Reputation: 1876

Are you trying to flag the images to skip them during parsing later?

$('img[src*="feedburner.com"]').addClass('ignore')

should do

Upvotes: 2

Related Questions