Last active
August 25, 2022 06:14
-
-
Save mikeott/d9a991b647fb56531409fbd8083c2da1 to your computer and use it in GitHub Desktop.
Verify Recaptcha
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit" async defer></script> | |
<form> | |
<div id="re-captcha"></div> | |
<input type="submit" value="Submit" id="contactFormSubmit" value="Submit" disabled /> | |
</form> | |
<script> | |
var actCallback = function (response) { | |
$('#contactFormSubmit').prop('disabled', false); | |
$('#re-captcha').remove(); | |
}; | |
var expCallback = function() { | |
$('#contactFormSubmit').prop('disabled', true); | |
}; | |
var onloadCallback = function () { | |
var widget = grecaptcha.render(document.getElementById('re-captcha'), { | |
'sitekey' : 'YOUR-SITE-KEY', | |
'theme': 'light', | |
'callback' : actCallback, | |
'expired-callback': expCallback, | |
}); | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment