JQ 全选 反选 取消全选的方法

    <button class="button" id="all">全选</button>
    <button class="button" id="fxall">反选</button>
    <button class="button" id="qxall">取消</button>

<script>
  // 全选
  $("#all").click(function(){ 
    $("input[name='jj_id']").prop("checked",true); 
  });
  // 反选
  $("#qxall").click(function(){ 
    $("input[name='jj_id']").prop("checked",false); 
  });
  //反选
  $("#fxall").click(function(){ 
    $("input[name='jj_id']").each(function(){ 
    if($(this).is(":checked")) { 
      $(this).prop("checked",false); 
    }else{ 
      $(this).prop("checked","true"); 
    } 
    }) 
  });
</script>

三个按钮对应三个函数

$("input[name='jj_id']")  这个则是你要勾选的复选框的name值
我的是
<input type="checkbox" name="jj_id" value="">
原文地址:https://www.cnblogs.com/lcxin/p/13570228.html