使用jquery关闭模式弹出框
问题描述:
下面的代码是我的弹出视图...我想关闭弹出窗口上点击关闭按钮(X)这是在弹出式顶部...在视图的底部我有jquery关闭popup..but那不是working..i有像父母弹出和儿童的另一个popup..just弹出popup.and在这种情况下,我不得不关闭弹出的孩子......请帮我使用jquery关闭模式弹出框
<div class="modal-dialog" style="width:1056px" id="pop">
<div class="modal-content">
<div class="modal-header">
<input type="button" onclick="close()" id="button" value="Close [x]" />
</div>
<div class="modal-body">
<div class="scroller">
<table class="display table table-striped table-bordered table-hover" id='tblTicket' cellspacing="0" width="100%">
<thead>
<tr>
<th>Data</th>
</tr>
</thead>
<tbody>
<tr>
<td>Data</td>
</tr>
</tbody>
</table>
<table class="display table table-striped table-bordered table-hover" id='tblTicket' cellspacing="0" width="100%">
<tr>
<th>DATA</th>
</tr>
@foreach (var item in Model)
{
<tr>
<td>
data
</td>
</tr>
}
</table>
</div>
</div>
</div>
</div>
<script type="text/javascript" language="javascript">
$("#button").click(function() {
$("#pop").close
});
</script>
答
尝试这
<script type="text/javascript" language="javascript">
$("#button").click(function() {
$('#pop').modal('hide');
});
</script>
+0
所有3个解决方案不工作在我的情况 –
答
请检查下面的代码:
<script type="text/javascript" language="javascript">
$("#button").click(function() {
$('#pop').modal('toggle');
$('#pop').modal('hide');
$('.modal-backdrop').removeClass('modal-backdrop');
$('.fade').removeClass('fade');
$('.in').removeClass('in');
$('html, body').css({
'overflow': 'auto',
'height': 'auto'
});
});
</script>
干杯!
[关闭引导模态(的可能的复制https://stackoverflow.com/questions/16493280/close-bootstrap-modal ) – Curiousdev