这是我的引导模态代码
<form class="form-horizontal" method="post" name="addform" id="formid">
<div id="myModal" >
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
<h3 id="myModalLabel">Add Question</h3>
</div>
<div class="modal-footer">
<input type="button" onClick="aj_add_question(<?=$id?>);" class="btn btn-primary" id="add_button" name="Add" value="Add Question">
<button type="button" class="btn btn" data-dismiss="modal" aria-hidden="true">cancel</button>
</div>
</div>
<div class="modal-footer">
<input type="button" value="Add Page" onclick="aj_add_page();" class="btn btn-primary" />
<button type="button" class="btn btn" data-dismiss="modal" aria-hidden="true">cancel</button>
</div>
</form>
现在点击
添加问题
我必须关闭当前弹出窗口
然后我写了代码
<script>
$(document).ready(function(){
alert("Question Added..");
$('#formid').hide();
});
</script>
它会隐藏但是屏幕变黑
答案 0 :(得分:0)
我认为您没有正确使用模态弹出语法,可以尝试以下方法:
<div class="modal fade" id="mymodal" tabindex="-1" role="dialog" aria-labelledby="mymodaltitle" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
**--- put your form here**
</div>
<div class="modal-footer">
</div>
</div>
</div>
</div>
然后,正如其他人建议使用 $(&#34; #mymodal&#34;)。modal(&#39; hide&#39;)