2010-11-17 77 views
1

非常复杂,但本质上很简单。自动勾选复选框,如果模态窗口提交按钮被点击

我有一个frm,带有一个tickbox和一个说明条款和条件的链接。

这个场景,用户点击链接,打开一个模式窗口。这有条款和条件,并且不能关闭,除非用户同意我们的条款,通过点击提交按钮(接受)

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

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

............. 模态窗口,全部完成工作精细和花花公子。它的提交按钮的代码是

<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> 

回答

2
<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。

相关问题