| |
$('#selectAll').click(function () { $("#reportTBody input:checkbox").prop('checked',true); }); $('#unSelect').click(function () { $("#reportTBody input:checkbox").prop('checked',false); }); $('#reverse').click(function () { $("#reportTBody input:checkbox").each(function () { $(this).prop('checked',$(this).is(':checked')?false:true); // if($(this).attr("checked")) // { // // $(this).removeAttr('checked'); // $(this).prop('checked',false); // }else{ // $(this).prop('checked',true); // // $(this).attr('checked',true); // } }) });
获取checkbox选中的值
$(document).ready(function(){ var checked = []; $("#submitButton").click(function(){ $('input:checkbox:checked').each(function() { checked.push($(this).val()); }); alert(checked); });});