Skip to content

Instantly share code, notes, and snippets.

@philchanet
Created August 29, 2017 09:27
Show Gist options
  • Save philchanet/23ea4c41a3f1195981352ef03790d9bf to your computer and use it in GitHub Desktop.
Save philchanet/23ea4c41a3f1195981352ef03790d9bf to your computer and use it in GitHub Desktop.
Open modal upon selection of an option in a select - class-based version
<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>
$('.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");
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment