Is it possible to prevent a user from closing a JavaScript alert until 10 seconds have passed?
I trigger an alert, and then user must wait “x” seconds to be able to close it.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Here’s a better way:
You’ll want to avoid alert, since you have no control over the dialog box with it. Instead, try a modal dialog like ThickBox. It’s a jQuery plugin (so you’ll need the jQuery library). Look at the “inline” example on this page: (click “demo” then “Show hidden modal content” link)
http://jquery.com/demo/thickbox/#sectiond-1
Initially, hide the
OKbutton and use asetTimeout()to then show it after 10 seconds.