Greasemonkey to hide an image?

Scorpion Ghost

Elite Member
Executive VIP
Jr. VIP
Joined
Mar 22, 2013
Messages
8,712
Reaction score
10,279
I hope I'm posting in the right section.

So I need to make Greasemonkey hide an image.

I've already set it to take effect on the page I want it to hide an image on, but I can't get a code to work to actually hide the image.

This is the image's HTML code:

HTML:
<img src="http://www.somesite.org/img/icon/something.png" alt="one" title="two" height="18px" width="50px">

So I know this code works:

HTML:
$('a').each(function(){
   if($(this).css('background-image')=='url("http://www.something.org/img/icon/something.png")'){
       $(this).parent().remove();
   } 
});

I know that the part ".css('background-image')...." is what defines what needs to be hidden, but how do I put that image above there so that it'll work??

Note: The image above (in the first HTML code) is NOT a background-image, that's why my solution doesn't work as it is.
 
Last edited:
try this with the url of your image
Code:
$('img').each(function(){ 
    if ($(this).attr('src') == 'http://www.somesite.org/img/icon/something.png' ){
        $(this).remove(); 
    }
});
 
Back
Top