Unobtrusive Confirm Javascript Replacement with jquery UI Dialog

Today I needed to implement an unobstrusive replacement for native alert and confirm functions for a client’s project. I searched a lot of libs and solutions but none of them worked as I wanted. So I decided to at least try to implement one real unosbtrusive replacement.

Here we go. First we need jQuery, jQuery UI Core (core, widget, position) and widget (dialog), choose any theme and we are set.

Take a look at the code below:

After that i need to overload the native confirm function. Check the next code:

Note that this function you can customize whatever you want, but here I’m using jQuery UI Dialog. You can try your own if you want, just pay attention on line 13, when I throw the callback. Of course, this is the first draft of workaround, maybe someone can increment the idea.

Heres the full code:

Did you like this? Share it:

84 Comments

  • cialis coupon |

    I found your blog website on google and test a number of of your early posts. Continue to maintain up the very good operate. I simply further up your RSS feed to my MSN News Reader. In search of ahead to studying extra from you later on!… generic cialis.

  • kamagra 100 mg no prescription |

    Most of what you state happens to be astonishingly precise and it makes me wonder why I had not looked at this with this light before. Your article really did switch the light on for me as far as this particular subject goes. Nonetheless there is actually one issue I am not necessarily too cozy with and whilst I make an effort to reconcile that with the main theme of the position, permit me see just what the rest of your subscribers have to say.Well done. kamagra.

  • ps4 games |

    I loved as much as you’ll receive carried out right here.
    The sketch is tasteful, your authored material stylish.
    nonetheless, you command get got an impatience over that you wish be delivering the following.
    unwell unquestionably come more formerly again since exactly the same nearly
    a lot often inside case you shield this increase.

  • quest bars cheap |

    Very nice post. I just stumbled upon your weblog and wished to say that I’ve really enjoyed surfing around your blog posts.
    In any case I will be subscribing to your rss feed and I hope you write again very soon!

  • quest bars cheap |

    Every weekend i used to visit this web site, as i wish for enjoyment, for the
    reason that this this website conations really fastidious funny stuff
    too.

  • quest bars cheap coupon twitter |

    Just want to say your article is as surprising. The clarity
    in your post is simply spectacular and i could assume you’re an expert on this subject.
    Fine with your permission allow me to grab your RSS feed to keep up
    to date with forthcoming post. Thanks a million and please continue the gratifying work.

  • quest bars cheap |

    My developer is trying to persuade me to move to .net from PHP.
    I have always disliked the idea because of the expenses.
    But he’s tryiong none the less. I’ve been using WordPress on a number of
    websites for about a year and am nervous about switching to another
    platform. I have heard good things about
    blogengine.net. Is there a way I can import all my wordpress posts into it?
    Any kind of help would be greatly appreciated!

  • ups drop box near me |

    Wonderful story, reckoned we could combine a handful of unrelated information, nonetheless actually worth taking a appear, whoa did a single find out about Mid East has got a lot more problerms also

  • Pilar |

    Hi there everyone, it’s my first visit at this web page, and paragraph
    is truly fruitful in favor of me, keep up posting such content.

  • ps4 games |

    When some one searches for his essential thing, therefore he/she wishes to be available that in detail, therefore that thing is maintained over here.

  • ROBUX GENERATOR |

    that may be the finish of this article. Right here youll come across some sites that we believe youll value, just click the links over

  • ps4 games |

    It’s enormous that you are getting ideas from this
    piece of writing as well as from our discussion made
    here.

  • ps4 games |

    I truly love your website.. Excellent colors & theme.

    Did you develop this amazing site yourself? Please reply back
    as I’m planning to create my very own website and want to find out where
    you got this from or just what the theme is named.
    Appreciate it!

  • Nicholas Hammack |

    It’s the best time to make some plans for the long run and it is time to be happy.
    I have read this put up and if I may I desire to suggest you few attention-grabbing things or suggestions.
    Maybe you can write next articles relating
    to this article. I want to read even more things about it!

  • ps4 games |

    It’s awesome to go to see this web site and reading the views of all mates about this piece of writing, while I am also keen of getting experience.

  • quest bars cheap |

    Hi! I know this is kind of off topic but I was wondering which blog platform are you
    using for this website? I’m getting fed up of WordPress because I’ve had issues with hackers and I’m looking
    at alternatives for another platform. I would be great if you could point me in the
    direction of a good platform.

  • rabbit vibe |

    although internet sites we backlink to below are considerably not connected to ours, we feel they’re really really worth a go as a result of, so have a look

So, what do you think ?