I'm facing the following situation: When an user clicks a submit button, the app disables the button. Then, when the callback function of the ReCaptcha is called, I can enable the button again. But if the user closes the verify window how can I know that and then enable my button again?
I was facing the same problem using invisible recaptcha. The way I solve it is observing when the captcha was getting closed. 
First get the div Element containing the captcha. 
let iframe = document.querySelector('iframe[src^="https://www.google.com/recaptcha"][src*="bframe"]');
let container = iframe.parentNode.parentNode;
Then
let observer = new MutationObserver( mutations => {
  if(container && container.style.visibility === 'hidden'){
     // Re enable the button 
  }
});
observer.observe(container, { attributes : true, attributeFilter : ['style'] });
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With