[英]Remove a confirm() dialog via javascript/jquery
In a javascript function, I do this for quick prototyping: 在javascript函数中,我这样做是为了快速制作原型:
if(confirm("are you sure you want to do this")) {
// do something
} else {
// do something else
}
If I get a specific event over a websocket, I want to remove this dialog in javascript/jquery. 如果通过网络套接字收到特定事件,我想在javascript / jquery中删除此对话框。 Any ideas how to do that?
任何想法如何做到这一点? Is there a DOM id or something for that?
是否有DOM ID或其他东西? Extra-Points if not even the else-block is executed when removing the dialog :)
删除对话框时,将执行Extra-Points甚至else块:)
You can't. 你不能 All javascript execution is halted while a
confirm
, alert
, or prompt
is displayed. 显示
confirm
, alert
或prompt
,所有JavaScript执行都将停止。
Dialog boxes are modal windows - they prevent the user from accessing the rest of the program's interface until the dialog box is closed.
对话框是模式窗口-在对话框关闭之前,它们阻止用户访问程序界面的其余部分。 For this reason, you should not overuse any function that creates a dialog box (or modal window).
因此,您不应过度使用任何创建对话框(或模式窗口)的功能。
https://developer.mozilla.org/en/DOM/window.confirm https://developer.mozilla.org/en/DOM/window.confirm
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.