Luca
Luca

Reputation: 335

Jquery: Hide all images except recaptcha image

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.

Upvotes: 1

Views: 3202

Answers (3)

Josh Stodola
Josh Stodola

Reputation: 82513

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();

Upvotes: 0

Incognito
Incognito

Reputation: 20765

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.

Upvotes: 2

Tatu Ulmanen
Tatu Ulmanen

Reputation: 124828

Something like this?

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

Upvotes: 5

Related Questions