jquery-ui-dialog - 如何挂钩到对话框关闭事件 [英] jquery-ui-dialog - How to hook into dialog close event
问题描述
我正在使用 jquery-ui-dialog
插件
I am using the jquery-ui-dialog
plugin
在某些情况下,当对话框关闭时,我正在寻找刷新页面的方法。
I am looking for way to refresh the page when in some circumstances when the dialog is closed.
有没有办法从对话框中捕获一个关闭事件?
Is there a way to capture a close event from the dialog?
我知道我可以在单击关闭按钮时运行代码,但不包括用户关闭使用转义或右上角的x。
I know I can run code when the close button is clicked but that doesn't cover the user closing with escape or the x in the top right corner.
推荐答案
我找到了它!
您可以使用以下代码捕获close事件:
You can catch the close event using the following code:
$('div#popup_content').on('dialogclose', function(event) {
alert('closed');
});
显然我可以用我需要做的任何事情来取代警报。
编辑:从Jquery 1.7开始,bind()已成为on()
Obviously I can replace the alert with whatever I need to do.
As of Jquery 1.7, the bind() has become on()
这篇关于jquery-ui-dialog - 如何挂钩到对话框关闭事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!