未勾选状态
勾选后
<!doctype html> <html> <head> <meta charset="utf-8"> <title>注册按钮是灰色,只有勾选同意后才能注册</title> </head> <body> <style> .box {margin-top:30px;padding-bottom:20px;text-align:center;} .vipHide {margin-top:30px;} </style> <div class="box"> <label><input name="" type="checkbox" value="" id="viewText">同意注册协议</label> <button type="submit" id="viewBtn"jQuery('.vipHide').show();jQuery('.clickBtn').hide();" disabled>立即注册</button> <div class="vipHide" style="display:none;"> 我是隐藏的内容 </div> </div> <script type="text/javascript" src="https://mbtxw.com/file/script/jquery-2.1.1.min.js"></script> <script> $(function(){ var regBtn = $("#viewBtn"); $("#viewText").change(function(){ var that = $(this); that.prop("checked",that.prop("checked")); if(that.prop("checked")){ regBtn.prop("disabled",false) }else{ regBtn.prop("disabled",true) } }); }); </script> </body> </html>
查看演示:https://sc.mbtxw.com/html/2222-1.html