【问题标题】:how to enable Multiple reCAPTCHA in single page如何在单页中启用多个 reCAPTCHA
【发布时间】:2014-04-22 18:05:42
【问题描述】:

我已经在单页中实现了两个recaptcha,但只有一个是recaptcha 工作

我的代码用于验证码 1

    <div class="resumator-label resumator-resume-text" id="resumator-recaptcha_forward-label">Human Check*</div>
    <div class="resumator-input" id="resumator-recaptcha_forward-field">
        <div id="div_error_resumator-forward-recaptcha-value" class="dv_error"><span>Please enter the text:</span></div><script type="text/javascript" src="//www.google.com/recaptcha/api/challenge?k=6Ld99tsSAAAAAIy-Zv3YKxCOefk2IXELOBVNhM7Y"></script>

<noscript>
    <iframe src="//www.google.com/recaptcha/api/noscript?k=6Ld99tsSAAAAAIy-Zv3YKxCOefk2IXELOBVNhM7Y" height="300" width="500" frameborder="0"></iframe><br/>
    <textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
    <input type="hidden" name="recaptcha_response_field" value="manual_challenge"/>
</noscript>
    </div>

其他验证码的代码

         <div class="resumator-field-wrapper resumator-resume-text" id="resumator-recaptcha">
    <div class="resumator-label resumator-resume-text" id="resumator-recaptcha-label">Human Check*</div>
    <div class="resumator-input" id="resumator-recaptcha-field">
        <script type="text/javascript" src="//www.google.com/recaptcha/api/challenge?k=6Ld99tsSAAAAAIy-Zv3YKxCOefk2IXELOBVNhM7Y"></script>

<noscript>
    <iframe src="//www.google.com/recaptcha/api/noscript?k=6Ld99tsSAAAAAIy-Zv3YKxCOefk2IXELOBVNhM7Y" height="300" width="500" frameborder="0"></iframe><br/>
    <textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
    <input type="hidden" name="recaptcha_response_field" value="manual_challenge"/>
</noscript>
    </div>
</div>

我也使用了可以正常工作的克隆

// 复制我们的 reCapcha

         $('#resumator-recaptcha-label').html($('#resumator-recaptcha_forward').clone(true,true));

克隆验证码中的问题,其重新加载验证码和其他链接不适用于新的克隆验证码

【问题讨论】:

标签: javascript php captcha recaptcha


【解决方案1】:

您可以尝试在第二个 recaptcha 加载器按钮中添加新类,然后使用 click 事件在该类上绑定事件,然后再次克隆您的节点并使用 setTimeout 函数,该函数将等待重绘验证码 希望对你有帮助

 setTimeout(function() {
        $( "#resumator-recaptcha #recaptcha_widget_div #recaptcha_reload_btn " ).addClass("reload_captcha");


         $(document).on('click', '.reload_captcha', function(e){
             $('#resumator-recaptcha-label').html($('#resumator-recaptcha_forward').clone(true,true));

             $( "#resumator-recaptcha #recaptcha_widget_div #recaptcha_reload_btn " ).addClass("reload_captcha");


        });

    }, 2000);

【讨论】:

    猜你喜欢
    • 2015-01-23
    • 2010-11-05
    • 2014-07-10
    • 2022-07-07
    • 2023-03-09
    • 2011-03-28
    • 2020-07-28
    • 2017-03-14
    • 1970-01-01
    相关资源
    最近更新 更多