Custom Alert / Confirm which waits for button click..?

I've been searching an answer for this question for a while. Still not getting any working solution..
To make mine web application UI and style comfortable, I've created my own alert- and confirm-boxes using
instructions at:

It works fine, if I don't want to redirect user after confirming the message with OK or Cancel.
It doesn't matter if I use custom alert or confirm, problem appears in both cases.
setTimeOut function or any other JS delay solution doesn't appear to work to freeze the application on alert-box.
It always disappears and redirects browser before clicking either OK or Cancel.

How can I possible force the JS application wait for user to click alert/confirm buttons??!
Is this even possible.. Any other "solutions" in this site doesn't seem to work..
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Can't you put your redirect code into the



Gaizka80Author Commented:
I figured out that solution also by myself.

If I still would like to use custom alert like native JS alert i still need some kind of wait-function..
Is it possible?!

if ( customConfirm('Sure?') ) {
  // Do something

So can I make customConfirm wait for button click and use it as above?
>>  I figured out that solution also by myself.

Ah, ok...

I don't think that code will do it...  Have you seen this though?

It might work better?


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Gaizka80Author Commented:
I tried that subModal-dialog, thank you for the link.

It's partly based on the same idea as customAlert, and it would possibly be better
solution if I need to show a lot of information (as in link page example) in modal window - I don't.

This modal window, as I tested it in practice, seems to be considerable slower than using customAlert.
I want my applications user actions to happen immediately. When using modal dialog, it seems just as it loads to another page.
It seems to have some scrolling problems too, that I already solved in my customAlert case.

Now that my customAlert & -Confirm seems to work well, I decide to remain on that solution too.
That subModal is still worth trying in some other case, it looks great.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.