title: second datepicker closes instantly
body: <p>I use the following code to in my web site to use jquery datepicker. </p>
  
  <pre><code>$('.datepicker').datepicker({  
              inline: true,
              showButtonPanel: true,
              showOtherMonths: true,
              showOn: "both",
              buttonImage: "/images/calendar.png",
              buttonImageOnly: true,
              beforeShow: function(elem){
                  setTimeout(function(){
                      var buttonPane = $(elem).datepicker("widget").find( ".ui-datepicker-buttonpane" ); 
                      var btn = $('&lt;a class="ui-datepicker-clear ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all"&gt;Clear Dates&lt;/a&gt;');
                      btn.unbind("click").bind("click", function () {
                          $.datepicker._clearDate(elem);  
                      });  
                      buttonPane.empty();
                      btn.appendTo(buttonPane); 
                  },1);
              },
              onChangeMonthYear:function(elem){
                  setTimeout(function(){
                      var buttonPane = $(elem).datepicker("widget").find( ".ui-datepicker-buttonpane" ); 
                      var btn = $('&lt;a class="ui-datepicker-clear ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all"&gt;Clear Dates&lt;/a&gt;');
                      btn.unbind("click").bind("click", function () {
                          $.datepicker._clearDate(elem);  
                      });  
                      buttonPane.empty();
                      btn.appendTo(buttonPane); 
                  },1);
              },
              onClose:function(){
                  $('#to').datepicker('show');
              },
              onSelect:function(date,inst){
                  $('#to').datepicker('show');
              }
          }); 
  </code></pre>
  
  <p>But when I select a date, the second datepicker opens and closes instantly as it open. Is there any thing wrong that I'm doing here?</p>