jquery checkbox

        //作废按钮:验证选择项 add by zhangzhu 2012-9-5
        $(document).ready(function () {
            $("#revokeBtn").click(function () {
                var count = 0;
                $("input[name=CheckBox]").each(function () {
                    if (this.checked) {
                        count++;
                    }
                });
                if (count == 0) {
                    jAlert("请选择作废项");
                    return false;
                } else if (count > 1) {
                    jAlert("只能选择一条作废项");
                    return false;
                } else {
                    return true;
                }
            });
        });

posted @ 2012-09-05 11:00  宁静.致远  阅读(137)  评论(0编辑  收藏  举报