Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
446 views
in Technique[技术] by (71.8m points)

javascript - jquery-ui-dialog - 如何挂钩到对话框关闭事件(jquery-ui-dialog - How to hook into dialog close event)

I am using the jquery-ui-dialog plugin

(我正在使用jquery-ui-dialog插件)

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?

(有没有办法从对话中捕获一个关闭事件?)

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.

(我知道我可以在单击关闭按钮时运行代码但不包括用户使用escape或右上角的x关闭。)

  ask by Brownie translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I have found it!

(我找到了!)

You can catch the close event using the following code:

(您可以使用以下代码捕获close事件:)

 $('div#popup_content').on('dialogclose', function(event) {
     alert('closed');
 });

Obviously I can replace the alert with whatever I need to do.

(显然,我可以用我需要做的任何事情来取代警报。)


Edit: As of Jquery 1.7, the bind() has become on()

(编辑:从Jquery 1.7开始,bind()已成为on())


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...