Skip to content

Instantly share code, notes, and snippets.

@qwersk
Created September 7, 2017 10:24
Show Gist options
  • Save qwersk/6dfd6a74f2ba933e2c3e7444716d4da0 to your computer and use it in GitHub Desktop.
Save qwersk/6dfd6a74f2ba933e2c3e7444716d4da0 to your computer and use it in GitHub Desktop.
Multiple Google Recaptcha #JS #JAVASCRIPT
<form>
<h1>Form 1</h1>
<div><input type="text" name="field1" placeholder="field1"></div>
<div><input type="text" name="field2" placeholder="field2"></div>
<div id="RecaptchaField1"></div>
<div><input type="submit"></div>
</form>
<form>
<h1>Form 2</h1>
<div><input type="text" name="field3" placeholder="field3"></div>
<div><input type="text" name="field4" placeholder="field4"></div>
<div id="RecaptchaField2"></div>
<div><input type="submit"></div>
</form>
<script type="text/javascript">
var CaptchaCallback = function() {
grecaptcha.render('RecaptchaField1', {'sitekey' : '6Lc_your_site_key'});
grecaptcha.render('RecaptchaField2', {'sitekey' : '6Lc_your_site_key'});
};
</script>
<script src="https://www.google.com/recaptcha/api.js?onload=CaptchaCallback&render=explicit" async defer></script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment