天天看点

全选和反选

$('table th .checkall').on('click', function () {

 if($(this).is(':checked')){

  $(this).closest('table').find(':checkbox').attr('checked', true);

  $(this).closest('table').find('tr').addClass('row_selected');

  //$(this).parent().parent().parent().toggleClass('row_selected'); 

 }

 else{

  $(this).closest('table').find(':checkbox').attr('checked', false);

  $(this).closest('table').find('tr').removeClass('row_selected');

 }

});