title: Maximum call stack size exceeded. In dialog open
body: <p>In my project I've a dialog that display two buttons (confirm and cancel) the action. But when this appears, if I move or I click on a button with a function associated with me cause this error:</p>
  
  <blockquote>
    <p>Uncaught RangeError: Maximum call stack size exceeded.</p>
  </blockquote>
  
  <p><strong>This is the function that display the dialog:</strong></p>
  
  <pre><code>displayConfirmMessageBox: function(title, message, messageButtons) {
      if(title == undefined || title == ''){
          title = "&lt;No message&gt;";
      }   
      if(message == undefined || message == ''){
          message = "&lt;No message&gt;";
      } 
      if(messageButtons == undefined){    
          messageButtons = {};
          messageButtons[EALang['close']] = function(){   
              jQuery("#message_box_confirm").dialog("close");
          };
      }
  
      jQuery("#message_box_confirm").dialog("destroy");
      jQuery("#message_box_confirm").remove();
      jQuery("body").append(
          "&lt;div id='message_box_confirm' title='" + title + "'&gt;" +
          "&lt;p&gt;" + message + "&lt;/p&gt;" +
          "&lt;/div&gt;"
      );    
  
      jQuery("#message_box_confirm").dialog({
          autoOpen      : false,
          modal         : true,
          resize        : "auto",
          width         : 400,
          height        : "auto",
          resizable     : false,
          buttons       : messageButtons,
          closeOnEscape : true
      });
  
      jQuery("#message_box_confirm").dialog("open"); 
      jQuery(".ui-dialog .ui-dialog-buttonset button").addClass('btn');
      jQuery("#message_box_confirm .ui-dialog-titlebar-close").hide();
  },
  </code></pre>
  
  <p><strong>and this is the function that call the <code>displayConfirmMessageBox</code>:</strong></p>
  
  <pre><code>var messageButtons = {};
  
  messageButtons['OK'] = function(){
      conferma = true;
      BackendCalendar.completeAppointmentStore(conferma, successCallback, errorCallback);
  };
  
  messageButtons[EALang['cancel']] = function(){
      conferma = false;
      $('#message_box_confirm').dialog('close');
  };
  
  GeneralFunctions.displayMessageBox(
      EALang['delete_resource_confirmation'], 
      EALang['warning_resource'], 
      messageButtons
  );
  </code></pre>
  
  <p>What am I doing wrong?</p>