views:

69

answers:

3

Hi to all, 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.com/recaptcha' or 'recaptcha.net' ... 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.

+1  A: 

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.

I have diffrent image id,tag,... Is possible to hide all site and then i show my interested with the command $("#ID").show(); ? Thanks again.
Luca
Tatu has a better solution, I would use that one if I were you. His/Hers does not use use ID tags, it works on the value of the recaptcha src attribute.
Thanks to all for help :-) But i use your solution becasue is the only that work in my script :-)
Luca
+5  A: 

Something like this?

$('img:not([src*=recaptcha])').hide();
Tatu Ulmanen
"Something like this?" is not the question. The answer though, is Yes.
Here Be Wolves
I have diffrent image id,tag,... Is possible to hide all site and then i show my interested with the command $("#ID").show(); ? Thanks again.
Luca
Thanks you too :-)
Luca
A: 

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();
Josh Stodola
Thanks you too :-)
Luca