I've searched in many threads but i don't see any checkboxes that involves tables, i just wanted to make deleting easy for users, Say, i have a table with fifty entries and i wanted to delete 10 all in one go, so i select the check box beside each record so when i want to delete it it will just get the values of the checkbox pass it on to a php script..
My question is how do i im[plement this on Javascript or jQuery?. getting the values from n numbers of checkboxes? since tables have a dynamic value depending on how many it has on the database.
Here is an image to be clear:

This will give you an array containing the value attribute of each checked box:
var values = $('input:checked').map(function() {
return this.value;
}).get();
See http://jsfiddle.net/p58Hw/1/
Select your table, find all rows with a checked checkbox, store their values, and remove them:
var $chkboxes = $(yourTable).find("tr input[type='checkbox']:checked");
var checkBoxVals = $chkboxes.map(function(){ return $(this).val(); }).toArray();
$chkboxes.closest('tr').remove();
// serialize array checkBoxVals and pass it to your php script
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With