input的checkbox设置全选中全不选中

$(function(){
    $("#check").click(function () {


    全选中
        if (this.checked) {
            $("input:checkbox").each(function () {
                $(this).prop("checked", true);
            });
        } else {
        
    全不选中
            $("input:checkbox").each(function () {
                $(this).prop("checked", false);
            });
        }
    });
});

猜你喜欢

转载自blog.csdn.net/memoryI/article/details/82145493