Answer the question
In order to leave comments, you need to log in
How to do grecaptcha.reset() for multiple captchas?
Connect google captcha script
<script class="g-recaptcha-script" src="https://www.google.com/recaptcha/api.js onload=onloadCallbackGoogleRecaptcha&render=explicit" async defer></script>
<div class="g-recaptcha-dynamic-initialized" id="g-recaptcha-dynamic-initialized1"></div>
еще одна форма
<div class="g-recaptcha-dynamic-initialized" id="g-recaptcha-dynamic-initialized2"></div>
var allCapthaForms = new Array()
var onloadCallbackGoogleRecaptcha = function() {
var wss = document.getElementsByClassName('g-recaptcha-dynamic-initialized')
Array.prototype.filter.call(wss, function(ws, i){
id = ws.getAttribute('id')
w=grecaptcha.render(id, {
'sitekey' : '<?=RE_SITE_KEY?>',
})
allCapthaForms.push(w)
});
};
var resetAllCapthaForms=function () {
allCapthaForms.forEach(function (item) {
grecaptcha.reset(item)
})
onloadCallbackGoogleRecaptcha()
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question