How to reload the google recaptcha widget after user submits invalid inputs How to reload the google recaptcha widget after user submits invalid inputs javascript javascript

How to reload the google recaptcha widget after user submits invalid inputs


The method you are looking for is grecaptcha.reset()

However, in order for this function to work you have to render the reCaptacha explicitly like this : <script src="https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit" async defer></script>


If you are using grecaptcha.render with jQuery, please ensure that you are actualy setting DOM element, instead of jQuery element:

This will work:

grecaptcha.render( $('.g-recaptcha')[0], { sitekey : 'your_key_here' });

but this wont:

grecaptcha.render( $('.g-recaptcha'), { sitekey : 'your_key_here' });


I was able to do it just by using:

grecaptcha.reset();