samedi 28 novembre 2020

Select All Checkboxes By Class in goup

hello community I have a question, I am using checkboxes within an html table, with name table1, and I managed to select all the checkboxes by means of only one, but at the time of putting another table the same, with name table2, with their id of the different checkbox Table1, when I click on select all, it selects the checkboxes of the two tables as I do so that each table selects only its checkboxes?

I am using this code in jquery to select all checkboxes from table 1:

 $("#checkbox-bulk-select").click(function () {
        $('input:checkbox').not(this).prop('checked', this.checked);
    }); 

and this from table 2:

 $("#checkbox-bulk-select2").click(function () {
            $('input:checkbox').not(this).prop('checked', this.checked);
        });

but it does not take the id, it selects all the checkboxes of both tables

these are the inputs to select all:

table1
    <input class="custom-control-input" id="checkbox-bulk-select" type="checkbox">

table2

<input class="custom-control-input" id="checkbox-bulk-select2" type="checkbox">

enter image description here




Aucun commentaire:

Enregistrer un commentaire