jquery实现checkbox全选/反选/取消

全选 反选 取消所有
IP port domain action
1.1.1.1 90 1.bai.com
1.1.1.2 92 2.bai.com
1.1.1.3 93 3.bai.com
1.1.1.4 94 4.bai.com

全选

$('input[name=ch_all]').change(function () {
            if($('input[name=ch_all]').is(':checked')){
                $('input[name=ch]').each(function () {
                $(this).prop('checked', true);
             });
            }else{
                $('input[name=ch]').each(function () {
                $(this).prop('checked', false);
             });
            };
        });

反选

取消

猜你喜欢

转载自www.cnblogs.com/zunwen/p/9947240.html