title: jQuery datepicker not closing
body: <p>My jQuery datepicker only closes when picking a date, but I want it to close when the user clicks away from or on the close button. However, even with the <em>showButtonPanel</em> option set to true, the close button does not appear but the 'Today' button does.</p>
  
  <p>I think it may have something to with having a custom onSelect action instead of the default but can't figure out how to close it myself. Tried using $.datepicker('hide') and ('destroy') but no difference.</p>
  
  <pre><code>$(document).ready(function() {
      $.datepicker.setDefaults({firstDay: 1, dateFormat: 'dd/mm/yy', showAnim: 'fade'});
  });    
  $(document).delegate('.editEndDate', 'click', function() {              
  $('.formattedEndDate').datepicker({
      defaultDate: $('.formattedEndDate').attr('id'),
      onSelect: function(dateText, inst) { 
      var date = dateText;
      var data = 'project=' + projectId + '&amp;date=' + date + '&amp;dateToChange=end';
          $.ajax({
              type: 'POST',
              url: 'helpers/change-project-date.php',
              data: data + '&amp;ajax=1',
              success: function(response){
                  getNotification(response);
                  $('.formattedEndDate').fadeOut(function() {
                      $(this).load(location.href+ ' .formattedEndDate', function() {
                          $(this).fadeIn('slow');
                      });
                  });     
              },
              error: function(response){
                  getNotification(response);
              },
              complete: function(response){
                  $('.formattedEndDate').datepicker('hide');
              }
          });
      }
  });
  return false;
  });
  </code></pre>
  
  <p>It may be something simple but I just can't see it. Thanks in advance.</p>