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 badges3 Answers
Reset to default 5Something 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();