jeudi 21 janvier 2021

JQuery: How to find multiple specific checkbox id's in a page of switchable checkboxes

I have looked at multiple SO suggestions using JQuery. So far nothing works for me. I have a page full of switchable checkboxes in a Laravel Blade file. The blade entry is surrounded by a foreach statement, thus producing multiple switch checkboxes on the page. Here is the entry in the blade file:

<div class="custom-control custom-switch">
    <input type="hidden" value="0" name="children[]">
    <input type="checkbox" class="custom-control-input" id="children[]" name="children[]"  value="1">
    <label class="custom-control-label" for="children[]">Absent / Present</label>
</div>

The objective is to collect all those switches which have been turned from off to on. Then they will be sent by ajax to a controller for updating either individually or collectively. Can someone help? Many Thanks.




Aucun commentaire:

Enregistrer un commentaire