在 javascript 函数中,我这样做是为了快速制作原型(prototype):
if(confirm("are you sure you want to do this")) {
// do something
} else {
// do something else
}
如果我通过 websocket 收到特定事件,我想在 javascript/jquery 中删除此对话框。任何想法如何做到这一点?有没有 DOM id 之类的东西?如果删除对话框时甚至没有执行 else block ,则加分 :)
最佳答案
你不能。当显示 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).
关于javascript - 通过 javascript/jquery 删除 confirm() 对话框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9045862/