mercredi 20 janvier 2016

How to get the label name as value for the selected/checked checkboxes in Django template

In django template , i have a modal which pops up on click of a span.

 <div class="modal-body">
     <form action="#">
         <fieldset>
             <legend>Please Select Your Option</legend>
                 <p><label style="font-size:15px;"><input type="checkbox" style="margin-right:5px;" id="selectAll"/>Select All</label></p>

                    {% for data in allData %}
   <p><label style="font-size:15px;" for={{data}}><input type="checkbox" style="margin-right:5px;" value={{data}}/>{{option}}</label></p>
             {% endfor %}
         </fieldset>
     </form>
</div>

I saw many examples and get to know that using ids i can access the value property of each checkbox. but i am really confused in this case where the no of checkboxes are dynamic.

I want to access the label name as the value . Any help?

Aucun commentaire:

Enregistrer un commentaire