Dynamically display buttons in dialog
Hello,
I would like to use the same dialog function to display alerts and confirm dialogs. Would I be able to have an if statement in the dialog code so I can display different buttons depending upon what parameters were passed into the function?
Something like:
- var alerter = function (passit, confirmationBox) {
$("#dialog-default > p").text(String(passit));
$("#dialog-default").dialog({
open: function () {
$(".ui-state-focus").blur();
},
buttons: {
- /* CHECK TO SEE IF CONFIRM BOX AND DISPLAY CONFIRM BUTTON */
if((confirmationBox) != undefined){
"Confirm" : function() {
window.location.href = targetUrl;
}
"Close": function () {
$(this).dialog("close");
}
}
});