- // 反选
- $("#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);
- });
- });
// 反选
$("#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);
});
});
在table上面每一行放了个checkbox 然后用按钮单击,实现反选
var statu=input.prop("checked")==true?false:true;
如果选中就为false否则为true
代码还可以精简的。