07.31《jQuery》——4.1注册页面的“接受协议”按钮

简单的写了一个根据checkbox的勾选与否决定按钮能否使用

<!DOCTYPE html>
<html>

    <head>
        <meta charset="UTF-8">
        <title></title>
        <script src="../jquery-3.2.1/jquery-3.2.1.js"></script>
        <script type="text/javascript">
            $(function() {
                $("#xieyi").click(function() {
                    if($("#xieyi").prop("checked") == true) {
                        $("#register").removeAttr("disabled");
                    } else {
                        $("#register").attr("disabled", "disabled");
                    }
                });

            });
        </script>
    </head>

    <body>
        同意该协议<input type="checkbox" name="xieyi" id="xieyi" />
        <input type="button" name="register" id="register" value="注册" disabled="disabled" />

    </body>

</html>

 

posted @ 2018-08-01 01:00  微光TeaRs  阅读(131)  评论(0编辑  收藏  举报