如果选择了选项,则显示引导模式
我有一个包含下拉列表和一些选项的表单:
Suggestions Inquiries Donations
我还有一个Bootstrap模态窗口:
如果选择值“捐赠”,我想显示Bootstrap模式。
我试过这样做:
$("#type").bind("change", function () { $('#myModal').modal('show')(this.value === 'donations'); }).change();
默认情况下打开模态,所以我知道我的目标是模态,但我只想在选择“捐赠”选项时显示。
有任何想法吗?
你这样试试..
$("#type").on("change", function () { $modal = $('#myModal'); if($(this).val() === 'donations'){ $modal.modal('show'); } });
$("#type").on("change", function () { $modal = $('#myModal'); if($(this).val() === 'donations'){ $modal.modal('show'); } });