如何在对话框中关闭 jQuery Dialog? [英] How to close jQuery Dialog within the dialog?
本文介绍了如何在对话框中关闭 jQuery Dialog?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在不使用关闭按钮的情况下在对话框中关闭 jQuery Dialog?
对话框内部是一个简单的表单请求.如果提交成功,则 UI 对话框会自动关闭并刷新父页面:
<div id="form-dialog" title="表单提交"><form action="default.aspx" method="post"><input type="text" name="name" value=""/><input type="submit" value="submit"/><a href="#" id="btnDone">关闭</a><script type="text/javascript">$(document).ready(function () {$("#btnDone").click(function () {$(this).dialog('close');});});</表单>
解决方案
试试这个
$(this).closest('.ui-dialog-content').dialog('close');
它会关闭里面的对话框.
How to close jQuery Dialog within the dialog without using the close button?
Inside the Dialog is a simple form request. If a successful submission occurs, then the UI dialog automatically closes and refreshes the parent page:
<script type="text/javascript">
$(document).ready(function () {
$("#form-dialog").dialog({
autoOpen: true,
modal: true,
width: 200,
draggable: true,
resizable: true
});
});
</script>
<div id="form-dialog" title="Form Submit">
<form action="default.aspx" method="post">
<input type="text" name="name" value=" " />
<input type="submit" value="submit" />
<a href="#" id="btnDone">CLOSE</a>
<script type="text/javascript">
$(document).ready(function () {
$("#btnDone").click(function () {
$(this).dialog('close');
});
});
</script>
</form>
</div>
解决方案
Try This
$(this).closest('.ui-dialog-content').dialog('close');
It will close the dialog inside it.
这篇关于如何在对话框中关闭 jQuery Dialog?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文