/ Published in: JavaScript
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
/** * 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)); }