I'm using reCaptcha v2 invisible
. I have a simple form with a disabled
submit button. Google reCAPTCHA is enabling my disabled button.
<script src="https://www.google.com/recaptcha/api.js"></script>
<form action="/action_page.php" id="referral-form">
First name:
<br>
<input type="text" name="firstname">
<br>
Last name:
<br>
<input type="text" name="lastname">
<br>
<input type="submit" id="form-submit-btn" disabled="disabled" class="g-recaptcha" data-callback='onSubmit' data-sitekey="***************" value="Submit">
</form>
function onSubmit() {
if (grecaptcha.getResponse() !== "") {
$('#referral-form').submit();
}
grecaptcha.reset();
}
When I remove class="g-recaptcha"
the button is properly disabled.