// Reverse selection
$("#reverse-select") .click(function() {
$('.table tr').each(function() {
var input = $(this).find('input');
var statu=input .prop("checked")==true?false:true;
input.prop("checked",statu);
});
});
I put a checkbox on each row of the table and click the button to reverse the selection
Mainly this line:
var statu=input.prop("checked")==true?false:true;
If checked, it is false Otherwise, it is true
The code can be simplified.