【问题标题】:Automatically tick checkbox, if modal window submit button is clicked如果单击模态窗口提交按钮,则自动勾选复选框
【发布时间】:2010-11-17 20:52:38
【问题描述】:

相当复杂,但本质上很简单。

我有一个框架,带有一个复选框和一个显示条款和条件的链接。

场景中,用户点击链接,打开一个模态窗口。这里面有条款和条件,除非用户同意我们的条款,否则不能关闭,点击提交按钮(接受)

我想要做的是,在原始表单上禁用复选框,直到他们打开模式窗口并接受条款,点击接受后,模式窗口关闭,复选框变为可见并被勾选。

任何想法,如何实现这一点,请。

...... 模态窗口,一切正常,花花公子。它的提交按钮代码是

<button class="btn btn-blue" onclick="$.lightbox().close();">I Accept these Terms and Conditions</button>

tickbox元素代码为:

<div class="checkbox">
                <span class="label">&nbsp;</span>
                <div><input name="tac" id="tac" class="checkbox" value="yes" type="checkbox"> &nbsp;&nbsp;<label style="display: inline;" for="tac">I agree to the <a href="terms.html?lightbox[width]=600&lightbox[height]=600&lightbox[modal]=true" class="lightbox">Terms and Conditions</a></label></div>
            </div>

【问题讨论】:

    标签: javascript jquery forms


    【解决方案1】:
    <button class="btn btn-blue" id="btnAcceptTerms">I Accept these Terms and Conditions</button>
    
    <div class="checkbox">
                    <span class="label">&nbsp;</span>
                    <div><input name="tac" id="tac" class="checkbox" value="yes" type="checkbox" disabled="disabled" > &nbsp;&nbsp;<label style="display: inline;" for="tac">I agree to the <a href="terms.html?lightbox[width]=600&lightbox[height]=600&lightbox[modal]=true" class="lightbox">Terms and Conditions</a></label></div>
    </div>
    
    $(document).ready(function(){
        $("#btnAcceptTerms").click(function(){
           $.lightbox().close();
           $("#tac").attr("disabled","");
        });
    });
    

    此代码禁用输入,直到您单击 btnAcceptTerms。

    【讨论】:

      猜你喜欢
      • 2019-05-23
      • 2014-02-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-05-04
      • 2017-10-10
      • 2013-08-24
      相关资源
      最近更新 更多