There are a few options for capturing events for alert and dialog boxes in jQuery including plugins and dialog boxes. Also jQuery UI offers us some options for custom dialogs. This page also offers a few good different types of modal windows.

Also you might consider using plain JavaScript you might do something like this, quick and easy!

var answer = confirm('Are you sure you want to delete this?');
if (answer)
{
  console.log('yes');
}
else
{
  console.log('cancel');
}
Sam Deering is a Front-end Web Developer who specialises in JavaScript & jQuery. Sam is driven and passionate about sharing his knowledge to educate others.

Free Guide:

How to Choose the Right Charting Library for Your Application

How do you make sure that the charting library you choose has everything you need? Sign up to receive this detailed guide from FusionCharts, which explores all the factors you need to consider before making the decision.


  • http://www.facebook.com/profile.php?id=660928137 Rami Kellesly

    Thank you Sam it’s very helpful ,Is there is a way to change the alert button text other than “ok” “cancel”?

  • http://www.facebook.com/nguyentrunghieu.hh Hiếu Nguyễn

    thank verry much

  • Ayesh

    Thanks!!

  • Sijo Thomas

    good one..thanks

Learn JavaScript for free!
Free course: Introduction to JavaScript

Yours when you take up a free 14-day SitePoint Premium trial.