ReCAPTCHA 占位符元素必须是元素或 ID [英] ReCAPTCHA placeholder element must be an element or id
本文介绍了ReCAPTCHA 占位符元素必须是元素或 ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在使用 google recaptcha 时遇到了一些问题.
i have some problem with google recaptcha.
我在同一个网站上放了 2 个 recaptachs,但在不同的位置.
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>
但它给了我这个错误:ReCAPTCHA 占位符元素必须是元素或 ID.
but its give me this error: ReCAPTCHA placeholder element must be an element or id.
我的代码:
<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.
感谢所有帮助.
推荐答案
仅在验证码标签之后附加您的脚本一次
attach your script only once and after captcha tag
这篇关于ReCAPTCHA 占位符元素必须是元素或 ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文