let's start from the beginning, but please don't panic... is a Jquery issue ;-)
I writing a PHP code: the user sends a query to our database and the form shows sets of results, grouped in tables, with checkboxes to select the data.
I would like to know how to enable a Jquery code to run with a Select/Deselect checkbox, to Select/Deselect the data of each table, i mean, each set of results.
For example, something like this example http://www.wiseguysonly.com/2010/01/15/select-and-unselect-all-checkboxes-with-jquery/
1: All checkboxes have a class of “checkbox”: input type=”checkbox” class=”checkbox”
function toggleChecked(status) {
$(".checkbox").each( function() {
$(this).attr("checked",status);
});
}
Could you tell me what is the best way to modify the toggleChecked function?
A second parameter to call toggleChecked, to replace ".checkbox" with the second parameter value? (i'm unable to find the correct syntax to do it).
Or there is a different way to do it?
And, BTW, is better to use prop instead attr? Best regards.