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

Posted on 2006-03-31
Last Modified: 2008-02-01
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..
Question by:Gaizka80
    LVL 35

    Expert Comment

    Can't you put your redirect code into the




    Author Comment

    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?
    LVL 35

    Accepted Solution

    >>  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?


    Author Comment

    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

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Join & Write a Comment

    Suggested Solutions

    This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
    JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
    The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
    The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now