javascript - 通过 javascript/jquery 删除 confirm() 对话框

标签 javascript jquery

在 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 ,则加分 :)

最佳答案

你不能。当显示 confirmalertprompt 时,所有 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

关于javascript - 通过 javascript/jquery 删除 confirm() 对话框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9045862/

相关文章:

javascript - 悬停按钮下拉菜单上的 Bootstrap

javascript - 如何在删除之前检查元素中是否包含 HTML?查询

javascript - 点击 Node.js 站点时偶尔出现 ERR_CONNECTION_RESET 错误

javascript - 如果没有循环,这个 JavaScript 问题是否可能?

java - Webdriver 按坐标单击元素两次

JavaScript - 使用数组索引转换为字符串

javascript - 如何将属性发送到自制事件?

javascript - 为什么需要一个额外的对象?

javascript - 将类添加到模板事件中的元素

javascript - JQuery如何获取当前输入类型?