views:

274

answers:

2

I need to find (and hide) all links with images (.jpg, .png, .gif) in href as they're causing my wordpress excerpts to break.

Many thanks.

+1  A: 

Okay, figured it :P

$("a[href$='.jpg']").addClass('hide');
Nimbuz
You could instead call `.hide()` if you'd rather.
gms8994
You should consider for .jpg , .jpeg , .JPG and .JPEGHaving David example to be case insensitive, and adding jpeg, should to the trick. (I'm not good with regex to write a proper answer, sorry)
UVL
+7  A: 
$('a').filter(function() {
    return $(this).attr('href').match(/\.(jpg|png|gif)/);
}).hide();
David
+1 I like this one... very DRY
alex
alex