checkbox多选框选择判断

全选<input type="checkbox" name="select" id="select" value="checkbox" onclick="selectAllCheckBox(this);" />
<input type='checkbox' name='id' value='"+list[i].id+"'/>
var arr = $("input[type='checkbox'][name='id']:checked");
var ids = "";
$.each(arr,function(index,o){
    ids = ids + $(o).val()+",";
});
ids = ids.substring(0,ids.length-1);
function selectAllCheckBox(o){
  var arr = $("input[name='id']");
  $.each(arr, function(index, current) {
      current.checked = o.checked;
  });
}

 

posted @ 2016-08-05 13:10  如果屈原会编程  阅读(387)  评论(0编辑  收藏  举报