title: jquery datepicker doesn't work after ajax call if its already on page
body: <p>I have a datepicker input (call it X) on my page already. There's a button that when you click on it, it makes an ajax call and prints some html stuff on page. Inside that ajax response, there's another datepicker input (call it Y), which works when you open it on a standalone page, but inside the ajax call, the Y doesn't show the datepicker box (it works on X however).</p>
  
  <p>The Y already has the "hasDatepicker" class, I've tried to remove it then recall the the datePicker method, but no luck. The only way I've managed to fix it, was to remove the "ui-datepicker-div" from page source and recall the datepicker on Y. But this time, X stops working!</p>
  
  <p>What is wrong with this way of using datepicker? Any way that I can make both of them working correctly?</p>
  
  <p><strong>UPDATE:</strong> I've managed to fix this by running these two commands before ajax call and then recalling datepicker after ajax call:</p>
  
  <pre><code>jQuery('.datepicker').datepicker("destroy");
  jQuery('#ui-datepicker-div').remove();
  </code></pre>
  
  <p>I don't know why, but the destroy command does not deletes the ui-datepicker-div and I have to remove it manually! Any clue about this?</p>