最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Jquery: Hide all images except recaptcha image - Stack Overflow

programmeradmin1浏览0评论

i need a code in Jquery for hide all images on all pages except the 'reCaptcha' thing. The images of reCaptcha start with the link: 'google/recaptcha' or 'recaptcha' ... My idea is to make the script that hide all images but not touch the images that contains the part 'recaptcha'. Is possible to make in Jquery? Thanks in advance and to all. Kind Regards. Luca.

i need a code in Jquery for hide all images on all pages except the 'reCaptcha' thing. The images of reCaptcha start with the link: 'google./recaptcha' or 'recaptcha' ... My idea is to make the script that hide all images but not touch the images that contains the part 'recaptcha'. Is possible to make in Jquery? Thanks in advance and to all. Kind Regards. Luca.

Share Improve this question asked Sep 13, 2010 at 14:29 LucaLuca 3351 gold badge4 silver badges15 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 5

Something like this?

$('img:not([src*=recaptcha])').hide();

First run $("img").hide(); then simply put an ID on the captcha tag and run $("#ID").show();

Or if you can't use an ID tag, cycle through all images in a loop and check what's in the src attribute, or even use a regex selector.

The ReCaptcha script puts all of its generated markup within a <div id="recaptcha_widget_div">

Having said that, you can grab all images except those within this DIV like this...

$("img:not(#recaptcha_widget_div img)").hide();

Or if that is too ugly, you can hide all images and re-show the ReCaptcha ones like this...

$("img").hide();
$("#recaptcha_widget_div img").show();
发布评论

评论列表(0)

  1. 暂无评论