vendredi 26 juin 2020

Getting the values of all checkbox checked in a group as comma separated

I have a group of checkbox

<div class="check_parent">
  <input type="checkbox" name="cmsms_which_days_are_you_most_likely" id="cmsms_which_days_are_you_most_likely1" value="1">
  <label for="cmsms_which_days_are_you_most_likely1">Monday</label>
</div>
<div class="cl"></div>
<div class="check_parent">
  <input type="checkbox" name="cmsms_which_days_are_you_most_likely" id="cmsms_which_days_are_you_most_likely2" value="2">
  <label for="cmsms_which_days_are_you_most_likely2">Tuesday</label>
</div>
<div class="cl"></div>
<div class="check_parent">
  <input type="checkbox" name="cmsms_which_days_are_you_most_likely" id="cmsms_which_days_are_you_most_likely3" value="3">
  <label for="cmsms_which_days_are_you_most_likely3">Wednesday</label>
</div>
<div class="cl"></div>
<div class="check_parent">
  <input type="checkbox" name="cmsms_which_days_are_you_most_likely" id="cmsms_which_days_are_you_most_likely4" value="4">
  <label for="cmsms_which_days_are_you_most_likely4">Thursday</label>
</div>
<div class="cl"></div>
<div class="check_parent">
  <input type="checkbox" name="cmsms_which_days_are_you_most_likely" id="cmsms_which_days_are_you_most_likely5" value="5">
  <label for="cmsms_which_days_are_you_most_likely5">Friday</label>
</div>
<div class="cl"></div>
<div class="check_parent">
  <input type="checkbox" name="cmsms_which_days_are_you_most_likely" id="cmsms_which_days_are_you_most_likely6" value="6">
  <label for="cmsms_which_days_are_you_most_likely6">Saterday</label>
</div>
<div class="cl"></div>
<div class="check_parent">
  <input type="checkbox" name="cmsms_which_days_are_you_most_likely" id="cmsms_which_days_are_you_most_likely7" value="7">
  <label for="cmsms_which_days_are_you_most_likely7">Sunday</label>
</div>

                                        

When the checkbox values are changing I want to get the checked values of checkbox as an array or comma separated value using jQuery.




Aucun commentaire:

Enregistrer un commentaire