jQueryUI Dialog

HTML

<button id="open">Do something</button>

JavaScript

// static method of jQuery
	(function($, $container) {
	  $.confirm = function(question, title) {
	    return $.Deferred(function(defer) {
	      $container.html(question).dialog({
	        'autoOpen': true,
	        'modal': true,
	        'title': title || 'Confirm',
	        'buttons': {
	          'Yes': defer.resolve,
	          'No': defer.reject
	        },
	        'close': defer.reject
	      });
	    }).always(function() {
	      $container.dialog('close');
	    }).promise();
	  }
	}(jQuery, $('<div/>')));

	$('#open').on('click', function() {
	  $.confirm('Really do it?').then(function() {
	    console.log('confirmed');
	  }, function() {
	    console.log('not confirmed');
	  });
	});