title: JQuery Dialog - execute code only when clicking "X" Button
body: <p>I have a dialog with two buttons (Yes-No). Each one triggers a function</p>
  
  <pre><code>$('#divDialog').dialog({
      modal:true,
      width:450,
      resizable: false,          
      buttons: [{
          text: 'Yes',
          click: function () {
              /*Do stuff when clicking yes*/
          }},{
              text: 'No',                
              click: function () {
                  /*Do stuff when clicking no*/
              }}],
      close: function(ev, ui){
          /*Do stuff always when closing*/                 
      }
  });
  </code></pre>
  
  <p>What I want to do is execute the same code as in the "No" button when you click the "X" button on top. So I put that code in the "close" function. But then the code is also executed when clicking "Yes".</p>
  
  <p>How can I execute that code when clicking "X" but not when clicking "Yes"?</p>
  
  <p>Thanks.</p>