4

I just upgraded from v2 and css is no longer a valid option for hiding the recaptcha badge from my UI. Can this be done with JavaScript?

dkershaw
  • 201
  • 3
  • 11
NatD
  • 43
  • 1
  • 4

2 Answers2

4

You can achieve this with recursion and requestAnimationFrame.

Try creating something like this:

function hideRecaptcha() {
    const recaptcha = $(".grecaptcha-badge");
    if (recaptcha.length) return recaptcha.css({ display: "none" });
    requestAnimationFrame(() => this.hideRecaptcha());
}

Then call hideRecaptcha() immediately after loading the recaptcha script.

dkershaw
  • 201
  • 3
  • 11
  • 1
    thanks! Just added this code and the recaptcha badge is finally hidden. – NatD Nov 01 '18 at 21:33
  • 2
    According to this https://stackoverflow.com/a/53986985/1729287 answer the `display: none` is disabling the spam check. Also you can must include a reCAPTCHA branding since you are using it. Check the FAQ https://developers.google.com/recaptcha/docs/faq – tasos Apr 17 '19 at 13:56
0

You should set it to visibility: none because it might disrupt the spam checking if you use display none and remove it completely.

See here. How to hide the Google Invisible reCAPTCHA badge

camelCode
  • 11
  • 2