[英]Javascript not wait file dialog closing
My problem is javascript not wait for file selection dialog closing. 我的问题是javascript不等待文件选择对话框关闭。 I have just found an solution that we declare a onChange event for element.
我刚刚找到了一个解决方案,我们为元素声明一个onChange事件。 So onChange event work right, but script still run before onChange event.
因此onChange事件工作正常,但是脚本仍在onChange事件之前运行。 They a asynchronous.
他们是异步的。 I think may be there is a way to check if there is any dialog opening ?
我认为可能有一种方法可以检查是否打开了任何对话框? Please help me, 2 day of mine :)
请帮我,我的2天:)
If you want to call back method after dialog is completely opened, you can use using jQuery Promise
object as mentioned in this answer: 如果要在对话框完全打开后调用方法,则可以使用此答案中提到的jQuery
Promise
对象:
$("#dialog").dialog({
show: {
effect: "drop",
direction: "up",
duration: 1000
},
hide: {
effect: "drop",
direction: "down",
duration: 1000
},
open: function () {
$(this).parent().promise().done(function () {
console.log("[#Dialog] Opened");
});
},
close: function () {
$(this).parent().promise().done(function () {
console.log("[#Dialog] Closed");
});
}
});
Here is the usual JSFiddle Demo: http://jsfiddle.net/losnir/jcmpm/ 这是通常的JSFiddle演示: http : //jsfiddle.net/losnir/jcmpm/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.