I am trying to replace javascript confirm (). I found a jquery dialog () function that can be fully customized. The problem is that I cannot make it return true or false.
Here is my code:
$('#delBox').dialog( { autoOpen: false, resizable: false, modal: true, closeOnEscape: true, width: 300, height: 'auto', title: 'Deletar registro', buttons: { "Ok": function () { return true; }, "Cancelar": function () { $(this).dialog("close"); return false; } }, open: function () { var buttonsSet = $('.ui-dialog-buttonset').find("button:contains('Ok')"); buttonsSet.attr("class", "ui-button ui-state-default"); $('.ui-dialog-titlebar-close span').empty(); $('.ui-dialog-buttonset').find("button:contains('Ok')").button({ text: false, icons: { primary: 'ui-icon-ok' } }); $('.ui-dialog-buttonset').find("button:contains('Cancelar')").button({ text: false, icons: { primary: 'ui-icon-cancel' } }); } });
This returns the object only until any option is selected:
function deletar() { alert($('#delBox').dialog('open')); }
javascript jquery user-interface dialog
dipi evil
source share