多选框的全选与取消全选

function choose(){   //为点击全选的框子添加时间
  var qx = document.getElementById("qx");  //id选择器
  if(qx.checked){    
    $("input:checkbox").prop("checked","true");  //全选
  }else{
    $("input:checkbox").removeAttr("checked"); //取消全选
  }

}

var salenos=[];

$("input[name='radio']:checked").each(function(){
  salenos.push($(this).val());   //获得选中多选框的值放到数组中
  //alert(salenos.length);
});

<input type="button" value="导出数据表格" style="" onclick="importOrderList($('input:checkbox:checked'))"/> //可用来判断是否有选中的多选框


猜你喜欢

转载自www.cnblogs.com/Allen-Wei/p/8991825.html