Search code examples
javascriptrecaptcha

How to Reload ReCaptcha using JavaScript?


I have a signup form with AJAX so that I want to refresh Recaptcha image anytime an error is occured (i.e. username already in use).

I am looking for a code compatible with ReCaptcha to reload it using JavaScript.


Solution

  • Important: Version 1.0 of the reCAPTCHA API is no longer supported. Please upgrade to Version 2.0.

    You can use grecaptcha.reset(); to reset the captcha.

    Source: https://developers.google.com/recaptcha/docs/display#js_api