• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 461
  • Last Modified:

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..
  • 2
  • 2
1 Solution
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?

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.

Featured Post


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now