【发布时间】:2013-10-09 00:53:45
【问题描述】:
我在一个页面中使用了两个 recaptcha,该页面有两种形式供不同的用户使用。
我正在使用自定义主题来使用 AJAX API 创建验证码:
function showRecaptcha(element) {
Recaptcha.create(
'publice_key',
element, {
theme: 'custom',
callback: Recaptcha.focus_response_field
});
}
我以两种模式使用它:
$("#to-teach").click(function() {
$("#sign-up-welcome").hide();
teachForm();
showRecaptcha('teachcaptcha');
return false;
});
还有一个
$("#to-student").click(function() {
$("#sign-up-welcome").hide();
studentForm();
showRecaptcha('studentcaptcha');
return false;
});
teachForm() 是:
function teachForm() {
Recaptcha.destroy('studentcaptcha');
signup.show();
signupTitle.text("Sign Up as a Teacher");
}
和类似的销毁事件用作Recaptcha.destroy('teachcaptcha');
自定义验证码的html是:
<div id="teachcaptcha">
<div id="recaptcha_image"></div>
<div class="captcha-input-box">
<input type="text" id="recaptcha_response_field" name="recaptcha_response_field" class="input-recaptcha" />
<a class="fontawesome-refresh" href="javascript:Recaptcha.reload()"></a>
<a class="fontawesome-headphones recaptcha_only_if_image" href="javascript:Recaptcha.switch_type('audio')"></a>
<a class="fontawesome-picture recaptcha_only_if_audio" href="javascript:Recaptcha.switch_type('image')"></a>
<a class="fontawesome-question" href="javascript:Recaptcha.showhelp()"></a>
</div>
</div>
对于studentcaptcha
也是如此问题是,如果我使用 white 主题而不是 custom 并且不在 <div id="studentcaptcha" or "teachcaptcha">...</div> 中放置任何自定义 html,则 destroy() 有效最好但是当我使用custom 主题并将我自己的html 放在div 上时它根本不起作用。
有什么建议吗?
【问题讨论】:
标签: javascript jquery css django recaptcha