Know if reCaptcha v2 was checked or not

Going back to your original post, there is no need to disable/enable the submit button when using reCaptcha. If the captcha is not solved, submitting the form won’t work (that’s how it’s meant to work.)

However, that said, if you really wish to do so, this is what I have managed to get working

function unHideButton() {
    const response = grecaptcha.getResponse()
    if (response.length !== 0) {
        // `submitBtn` is the id I gave the form submit button
        document.getElementById('submitBtn').disabled = false
    }
}
const addCallback = setTimeout(() => {
    // Need to check reCaptcha exists before adding callback
    // or reCaptcha will fail to load
    if (grecaptcha) {
        const rcv2 = document.querySelector('.g-recaptcha');
        rcv2.dataset.callback = "unHideButton";
        clearTimeout(addCallback);
    }
}, 100);
1 Like