Skip to content

Instantly share code, notes, and snippets.

@ssddanbrown
Created January 25, 2015 15:51
Show Gist options
  • Save ssddanbrown/2f89e0c34fde89f9fcf4 to your computer and use it in GitHub Desktop.
Save ssddanbrown/2f89e0c34fde89f9fcf4 to your computer and use it in GitHub Desktop.
Mulitple Google Captchas
<!--Remote Google Script-->
<script src="https://www.google.com/recaptcha/api.js?onload=onCaptchaLoad&render=explicit" async defer></script>
<!--Local site script-->
<script>
var onCaptchaLoad = function() {
var captchaElements = document.querySelectorAll('div[data-captcha="true"]');
for (var i = captchaElements.length - 1; i >= 0; i--) {
grecaptcha.render(captchaElements[i], {
'sitekey': 'SITE_KEY',
'theme': 'light'
});
}
};
</script>
<!--Inserting a captcha-->
<div data-captcha="true"></div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment