Code-CheckBox:复选框全选/取消

ylbtech-Code-CheckBox:复选框全选/取消
1. JS返回顶部
1、
$(function () {
    $("#ContentPlaceHolder1_gvwList :checkbox").eq(0).click(function () {
        if ($(this).is(":checked")) {
            $(this).parent().parent().nextAll().find(":checkbox").attr("checked", "checked");
        }
        else {
            $(this).parent().parent().nextAll().find(":checkbox").removeAttr("checked");
        }
    });
    $("#ContentPlaceHolder1_gvwList :checkbox").not($("#ContentPlaceHolder1_gvwList :checkbox:first")).click(function () {
        if ($(this).is(":checked")) {
            if ($("#ContentPlaceHolder1_gvwList :checked").length == $("#ContentPlaceHolder1_gvwList :checkbox").length - 1) {
                $("#ContentPlaceHolder1_gvwList :checkbox").eq(0).attr("checked", "checked");
            }
        }
        else {
            $("#ContentPlaceHolder1_gvwList :checkbox").eq(0).removeAttr("checked");
        }
    });
});
2、
2.返回顶部
 
3.返回顶部
 
4.返回顶部
 
5.返回顶部
 
 
6.返回顶部
 
warn 作者:ylbtech
出处:http://ylbtech.cnblogs.com/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
原文地址:https://www.cnblogs.com/storebook/p/13087403.html