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 Sam Deering
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.

  • 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

Related books & courses
Available now on SitePoint Premium

Preview for $1