When the left checkbox is checked then all the chekbox that are right on the right side must be cheked

  html, javascript, jquery, laravel, laravel-blade

I have tried this code but it only worked once after that i have to refresh the page and then again it will work only once.

 `enter code here`<tr class="all">
                        <!--Guarito=Healed  -->
                        <th style="width:30vh" class="table-info">Guarito</th>


                        <input  type="checkbox" name="Guarito-{{$i}}" id="Guarito-{{$i}}" class="selectall"

                            @if(!empty($FollowupTreatment[$i] ->guarito) && $FollowupTreatment[$i] ->guarito == 1)


Here is the code between script tag

$('.selectall').click(function() {

                    if ($(this).is(':checked')) {
                        $('.all input').attr('checked', true);
                    } else {
                        $('.all input').attr('checked', false);

Source: Laravel

Leave a Reply