jQuery CheckBox全选、反选

来源:互联网 发布:淘宝招聘模特 编辑:程序博客网 时间:2024/05/18 03:17
    //全选    $("#selectall").bind("click", function () {        var cb = $("#datatablename :checkbox");        cb.attr("checked", true);    });    //全不选    $("#selectnone").bind("click", function () {        var cb = $("#datatablename :checkbox");        cb.attr("checked", false);    });    //反选    $("#selectinvert").bind("click", function () {        var cb = $("#datatablename :checkbox");        cb.each(function () {            this.checked = !this.checked;        });    });    //切换checked选中状态    $("#IsAgree").bind("click", function () {        if ($(this).attr("checked") == "checked") {            $(this).removeAttr("checked")        } else {            $(this).attr("checked", "true");        }    });
0 0
原创粉丝点击