In a javascript function, I do this for quick prototyping:
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. Any ideas how to do that? Is there a DOM id or something for that? Extra-Points if not even the else-block is executed when removing the dialog :)
You can't. All javascript execution is halted while a confirm
, alert
, or prompt
is displayed.
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).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.