samedi 21 octobre 2017

Checking which checkbox was checked

I am implementing Multiple select with checkboxes and jQuery as described at http://ift.tt/1mlnto3

This is the example shown in the website:

<div class="multiselect">
<label><input type="checkbox" name="option[]" value="1" />Green</label>
<label><input type="checkbox" name="option[]" value="2" />Red</label>
<label><input type="checkbox" name="option[]" value="3" />Blue</label>
<label><input type="checkbox" name="option[]" value="4" />Orange</label>
<label><input type="checkbox" name="option[]" value="5" />Purple</label>
<label><input type="checkbox" name="option[]" value="6" />Black</label>
<label><input type="checkbox" name="option[]" value="7" />White</label>

The dropdown list with checkboxes is showing as expected. In one page, I am displaying three such lists.

The question is how do I determine using javascript which of the checkboxes under each of the lists have been selected. I also need to obtain the value of the selected item. Which of these have to tagged with an id?




Aucun commentaire:

Enregistrer un commentaire