just wanted to know if it is programatically possible to halt the execution of script the same way javascript function “confirm” does. “confirm” stops further execution of script until user input, i want to acheieve same thing for BlockUI plugin of Jquery.
Share
No, you cannot.
confirm, like thealertfunction, is a modal dialog, which is nothing more than a child window that requires users to interact with it before they can return to operating the parent application, thus preventing the workflow on the application main window.Javascript has no sleep-ing mechanism. If you want to stop the execution of a script… it’s only possible by executing another script that is memory/CPU expensive (such as an infinite loop) that will freeze the browser (thus stopping the targeted script from executing), but that kind of defeats the purpose.
If you know what you want to do, you can organize your code in such a manner that you can simulate the sleep process.
A good way of doing that is using callbacks combined with timeouts: