philchanet
12/6/2016 - 3:17 PM

Show modal on option selection Can be used with multiple selects

Show modal on option selection Can be used with multiple selects

$('.action-list').change(function() {
    var action = $(this).val();
    if(action == "action1"){
        $('#modal1').modal("show");
    }
    if(action == "action2"){
        $('#modal2').modal("show");
    }
});
<select class="selectpicker action-list">
    <option value="action1">Action 1</option>
    <option value="action2">Action 2</option>
</select>

<div class="modal fade" tabindex="-1" role="dialog" id="modal1">...</div>
<div class="modal fade" tabindex="-1" role="dialog" id="modal2">...</div>