title: JQUERY-ui dialog x button function
body: <p>I'm using the <a href="http://jqueryui.com/demos/dialog/" rel="nofollow noreferrer">jquery-ui dialog box</a>.
  My problem is upon clicking the x button to close the dialog, i also need to perform the cancel() function.</p>
  
  <p>How can I do this?</p>
  
  <pre><code>var content = 
  {
      autoOpen    : false,
      modal       : true,
      width       : 350,
      minHeight   : 50,
      height      : 350,
      position    : "center",
      resizable   : false,
      draggable   : false,
      close       : function () {$(".privacy_modal").prop("checked", false);},
      buttons: 
      {
          "Cancel": function cancel() 
          { 
              $(".privacy_modal").prop("checked", false); $(this).dialog("close"); 
          },
          "Accept": function accept() 
          {
              $(".privacy_modal").prop("checked", true); $(this).dialog("close"); 
          }
      }
  };
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/M77qF.png" alt="TEST"></p>
  
  <p>NOTE: Using close doesn't solve my problem because it overrides the function when i clicked the accept button</p>