I am trying to do the following.
- When the user clicks on a button a modal should show up
- The modal should show a different content depending on which button has been pressed
- There are many buttons of that kind on my site. So I want to pass a variable to the modal and make an if comparison
Here is my modal
<div class="modal fade" id="group_selection" role="dialog">
 <div class="modal-dialog">
  <div class="modal-content">
          <div class="modal-header">
              <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
              <h4 class="modal-title" id="myModalLabel">Select the journal club for which this vote should count</h4>
          </div>
          <div class="modal-body">
                <form>
                  {% for group in groups %}
                      <input class="group_sel" type="checkbox" value="{{ group[0] }}">{{ group[0] }}
                      </input><br>
                  {% endfor %} 
              </form>
          </div>
          <div class="modal-footer">
              <input class="btn btn-primary multivote" type="submit" data-dismiss="modal" value="Select" />
              <input class="btn btn-default" type="button" data-dismiss="modal" value="Close" />
          </div>  
      <!-- </form>  -->                                
  </div>
The modal above shows a selection of groups. This selection is the same for each modal, so that works fine, but now I want to disable the input statement in the for loop depending on which button has been pressed to get to this modal.
I don't know how to create new variables within html. I was hoping that jQuery can help with this, so I trigger the modal with the following jQuery command
<script type="text/javascript">
$(document).ready(function(){
   $(".vote").click(function(){ 
      $('#group_selection').modal('show');
   });
});
</script>
I know that I can use jQuery to write values into the html code (as shown here Passing data to a bootstrap modal) but I don't see how I can use that to make an if selection?
Thanks for your help
best
carl
 
     
    