Reputation: 79
i have some problem with google recaptcha.
i put 2 recaptachs in same website but in deferent locations.
<div class="g-recaptcha" id="recaptcha1"></div>
<div class="g-recaptcha" id="recaptcha2"></div>
but its give me this error: ReCAPTCHA placeholder element must be an element or id.
my code:
<script src="https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit" async defer></script>
<script type="text/javascript">
var recaptcha1;
var recaptcha2;
var onloadCallback = function() {
//Render the recaptcha1 on the element with ID "recaptcha1"
recaptcha1 = grecaptcha.render('recaptcha1', {
'sitekey' : '*******', //Replace this with your Site key
'theme' : 'light'
});
//Render the recaptcha2 on the element with ID "recaptcha2"
recaptcha2 = grecaptcha.render('recaptcha2', {
'sitekey' : '*******', //Replace this with your Site key
'theme' : 'light'
});
grecaptcha.reset(recaptcha1);
grecaptcha.reset(recaptcha2);
};
</script>
i plase all the script and the code in the before
i did a reserach here but its still not working.
thanks for all the help.
Upvotes: 1
Views: 9311