mardi 8 novembre 2016

Select all checkoxes if selected top one laravel 5.3

in my user.js file i have wrote following method as

js

$('.group-selector-campaign').click(function () {
    if($(this).is(':checked')) {
        $('.group-campaign-').prop('checked', true);
    } else {
        $('.group-campaign-').prop('checked', false);
    }
});

View

 <label class="mt-checkbox mt-checkbox-single mt-checkbox-outline">
<input type="checkbox" class="checkboxes">
                     </label>
                            </th>
                            <th>Name</th>
                            <th>Email</th>
                            <th>Created at</th>
                            <th>Actions</th>

Its my header and i want if header checkbox selected all below checkbox will also b select automatically. Below for all other table fields i use this for 2nd line and so on

<label class="mt-checkbox mt-checkbox-single mt-checkbox-outline">
  <input type="checkbox" class="checkboxes" value="1">
                                   </label>

its not working dont know why. Ist of all is my function correct if yes then how and where add group-selector-campaign class to work properly




Aucun commentaire:

Enregistrer un commentaire