开发者

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

开发者 https://www.devze.com 2022-12-13 10:25 出处:网络
I need to find (开发者_JS百科and hide) all links with images (.jpg, .png, .gif) in href as they\'re causing my wordpress excerpts to break.

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

Many thanks.


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


Okay, figured it :P

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

精彩评论

暂无评论...
验证码 换一张
取 消