I want to run alert("hi")
in 3 seconds after alert("hello")
without clicking on OK of "hello" alert.
This is my code:
$(function(){
alert("hello");
setTimeout(function(){
alert("hi");
},3000)
})
I want to run alert("hi")
in 3 seconds after alert("hello")
without clicking on OK of "hello" alert.
This is my code:
$(function(){
alert("hello");
setTimeout(function(){
alert("hi");
},3000)
})
Share
Improve this question
edited Jan 29, 2015 at 9:11
Nikolay Kostov
17k23 gold badges89 silver badges129 bronze badges
asked Jan 29, 2015 at 8:54
Akshay JainAkshay Jain
514 bronze badges
2 Answers
Reset to default 9If you read the doc you will understand that is not possible:
Notes
The alert dialog should be used for messages which do not require any response on the part of the user, other than the acknowledgement of the message.
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).
Chrome users (e.g. extensions) should use methods of nsIPromptService instead.
When alert
alerts, it blocks the UI as well as the thread. do that. The next line of code runs after the alert
has been dismissed.
So, there's no way to do that. You can use Twitter's Bootstrap's modals, may be. (There are many others too, like Foundation, jQuery UI that gives you the ability to have a modals)