--------------Select all:
<label><input type= "checkbox" id= "All"/> Select </label>
<script>
var status=true;
$ ("#all"). Click (function () {
if (status) {
$ ("#selectAll Input[type=checkbox]"). each (function () {
$ (this). attr ("Checked", "checked");
});
Status=false;
}else{
$ ("#selectAll Input[type=checkbox]"). each (function () {
$ (this). attr ("Checked", "" ");
});
Status=true;
}
});
</script>
--------------Delete the selected:
<input type= "button" class= "delete" value= "Delete selected" >
<script>
$ (". Delete"). Click (function () {
var chk_len=$ ("#selectAll input[type=checkbox]:checked"). length;//Number of selected
var chk_obj=$ ("#selectAll input[type=checkbox]:checked");//check box object
var del_ids= ';
if (Chk_len > 0) {
for (var i = 0; i < Chk_len; i++) {//combine ID to delete
Del_ids+=chk_obj.eq (i). Val () + ', ';
}
Del_ids =del_ids.substring (0,del_ids.length-1);//Delete last comma
if (Confirm (' Total selection ' +chk_len+ ' Bar, is you OK? ')) {
Location.href = ' mh/mhdelete?ids= ' +del_ids;
}
} else {
Alert (' Select at least one item! ');
}
});
</script>
jquery Select All, Delete selected