jquery-ui-dialog - 如何挂钩对话框关闭事件 [英] jquery-ui-dialog - How to hook into dialog close event

查看:38
本文介绍了jquery-ui-dialog - 如何挂钩对话框关闭事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 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.

推荐答案

我找到了!

您可以使用以下代码捕获关闭事件:

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆