philchanet
8/29/2017 - 9:27 AM

Open modal upon selection of an option in a select - class-based version

Open modal upon selection of an option in a select - class-based version

$('.actions-more').change(function() {
  var action = $(this).val();
  if(action == "withdraw"){
      $('#horseWithdraw').modal("show");
  }
  else if(action == "substitute"){
      $('#horseSubstitute').modal("show");
  }
  else if(action == "setHorsePriority"){
      $('#setHorsePriority').modal("show");
  }
  else if(action == "viewlog"){
      $('#feiLogsShow').modal("show");
  }
  else if(action == "comment"){
      $('#addComment').modal("show");
  }
});
<select class="selectpicker actions-more" data-style="btn-default btn-xs" data-width="auto" data-container="body" title="Horse...">
    <option disabled>Substitute</option>
    <option value="withdraw">Withdraw</option>
    <option value="comment">Comment</option>
    <option value="viewlog">View log</option>
</select>