title: jQuery UI dialog with boolean return - true or false
body: <p>I´m trying to do an replacement for the <strong>javascript</strong> confirm(). I have found the jquery dialog() function that can be fully customized. The problem is that i cant make it return <em>true</em> or <em>false</em>.</p>
  
  <p>Here is my code:</p>
  
  <pre><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'
                      }
                  });
              }
          });
  </code></pre>
  
  <p>This only return an object before any option selected:</p>
  
  <pre><code>function deletar() {
       alert($('#delBox').dialog('open'));
  }
  </code></pre>