Ok, I\'m doing a bunch of RIA/AJAX stuff and need to create a \"pretty\", custom confirm box which is a DIV (not the built-in javascript confirm). I\'m having trouble determ
Check out my Fiddle modal alert box: http://jsfiddle.net/katiabaer/UXM9y/33/ with JqueryUI modal
showAlert = function (msg, header, callback) {
var mydiv = $(" ");
mydiv.alertBox({
message: msg,
header: header,
callback: callback
});
},
$('#show').click(function () {
var m = $('#message').val();
var h = $('#header').val();
var callback = function () {
alert("I can do anything here");
}
showAlert(m, h, callback);
});
$.widget("MY.alertBox", {
options: {
message: "",
header: "",
callback: ''
},
_create: function () {
var self = this;
self.callback = self.options.callback;
self.container = $(".alert-messagebox");
var header = self.container.find(".alert-header");
header.html(self.options.header);
var message = self.container.find(".alert-message");
message.html(self.options.message);
var closeButton = self.container.find("button.modal-close-button");
closeButton.click(function () {
self.close();
});
self.show();
},
show: function () {
var self = this;
self.container.modal({
maxWidth: 500
});
},
close: function () {
if (this.callback != null) {
this.callback();
$.modal.close();
return;
}
$.modal.close();
},
destroy: function () {
$.Widget.prototype.destroy.call(this);
}
});