eozzy
eozzy

Reputation: 68760

Find <a> with image extension in href (jQuery)

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.

Upvotes: 3

Views: 4583

Answers (2)

David Hellsing
David Hellsing

Reputation: 108520

$('a').filter(function() {
    return $(this).attr('href').match(/\.(jpg|png|gif)/i);
}).hide();

Upvotes: 13

eozzy
eozzy

Reputation: 68760

Okay, figured it :P

$("a[href$='.jpg']").addClass('hide');

Upvotes: 3

Related Questions