Return to Snippet

Revision: 31073
at August 28, 2010 20:47 by joernroeder


Initial Code
/**
 * Override javascript alert() and wrap it into a jQuery-UI Dialog box
 *
 * @depends $.getOrCreateDialog
 *
 * @param { String } the alert message
 * @param { Object } jQuery Dialog box options 
 */
function alert(message, options) {
	
	var defaults = {
		modal		: true,
		resizable	: false,
		buttons		: {
			Ok: function() {
				$(this).dialog('close');
			}
		},
		show		: 'fade',
		hide		: 'fade',
		minHeight	: 50,
		dialogClass	: 'modal-shadow'
	}
		
	$alert = $.getOrCreateDialog('alert');	
	// set message
	$("p", $alert).html(message);
	// init dialog
	$alert.dialog($.extend({}, defaults, options));
}

Initial URL


Initial Description


Initial Title
alert() to jQuery UI Dialog

Initial Tags
jquery

Initial Language
JavaScript