根据是否选中复选框来设置按钮的可用性

$(document).ready(function () {
            var arrObj = $("input[type='checkbox']");
            arrObj.each(function () {
                $(this).bind("click", function () {
                    var i = 0;
                    arrObj.each(function () {
                        if ($(this).attr("checked")) {
                            i++;
                        }
                    });
                    if (i > 0) {
                        $("#btn").attr("disabled", false);
                    }
                    else {
                        $("#btn").attr("disabled", true);
                    }
                })
            })
        });

posted on 2013-04-17 22:38  dengjd  阅读(329)  评论(0编辑  收藏  举报

导航