示例:当我选择“volvo”选项时,模态会出现。 模态显示不正确。
<>
答案 0 :(得分:0)
这可能对您有所帮助
<强> HTML 强>
<label>Recinto</label>
<select class="form-control">
<option>O meu coliseu</option>
<option>volvo</option>
<option>A minha arena</option>
<option>a garagem da minha vizinha</option>
<option>Na esquina</option>
</select>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<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">Modal title</h4>
</div>
<div class="modal-body">
Show what you want
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>
<强>的JavaScript 强>
$(document).ready(function() {
$('select').change(function() {
if ($(this).val() == "volvo") {
$('#myModal').modal('show');
}
});
});