WEll,从选择下拉菜单中选择选项时出现的模式
如果选择了选择下拉菜单中的某个选项,我试图显示一个模式窗口。如果不是使用select中的选项,而是使用简单的按钮,但是我需要从select中选择它,它确实有效。
屏幕虽然改变了它的不透明度,所以我想我正在做一些事情......但错了。很明显,我有我需要的bootstrap链接和脚本,打开并关闭doc和html。
有什么建议吗?
谢谢youuu
html
------------------------------------------------------------------------
<select id="selectAction" data-style="btn-info" onchange="newGraph(this)">
<option value="" disabled selected>Select your option:</option>
<option value="create">Create a new graph</option>
<option value="recall">Recall a saved graph</option>
</select>
<!--Pop up window-->
<div data-toggle="modal" data-target="#popUp1"> //it works if I put this in a <button> instead a div, but then, I have to click to button to make the modal to work so it in not what I want.
<div class="modal hide fade" id="popUp1" tabindex="-1" role="dialog" aria-labelledby="popUp1" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
<h4>Creating a new graph:</h4>
</div>
<div class="modal-body">
<p>Here some text</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-success">Save changes</button>
</div>
</div>
</div>
</div>
</div>
script
--------------------------------------------------------------------------------
function newGraph(element) {
if($(element).val() === 'create') {
$('.toolsHeader').show();
$('#popUp1').modal();
$('#selectAction').hide();
}
else{
return false;
}};
您需要将所有内容放入'$(function(){})'中,并在使用jquery时摆脱inline'onchange'事物。这就是你需要的所有东西 – Yang 2014-11-14 13:25:42