title: jQuery datepicker does not work after Ajax call
body: <p>Here is the situation: I'm using jQuery to dynamically load a form. In that form, there is a datepicker from jQueryUI. The problem is that the datepicker loads the first time, but if the form is loaded again, the datepicker doesn't work. I know I need to rebind the datepicker function each time the page is loaded, but all of my attempts have failed. Any help would be appreciated!</p>
  
  <p>Code snippet below:</p>
  
  <pre><code>function makeMyDay() 
  {
      $(".datepicker").datepicker(
      {
          inline: true
      });
  }
  
  function getNewPage(id,idTwo)
  {
      $.ajax(
      {
          type: "GET",
          url: 'foo.php',
          data: "id=" + id,
          success: function(data) 
          {
              $('.bar' + idTwo).html(data);
              makeMyDay();
          }
      });
  }
  </code></pre>
  
  <p>Just in case it needs clarifying, foo.php gets loaded into .bar. The datepicker itself is in foo.php, and the external JS files are in the main file, not foo.php.</p>
  
  <p><strong>Edit</strong></p>
  
  <p>Updated code below, but the problem still persists:</p>
  
  <pre><code>$(function()
  {
      $('.datepicker').datepicker({inline: true});
  });
  
  function getNewPage(id,idTwo)
  {
      $.ajax(
      {
          type: "GET",
          url: 'foo.php',
          data: "id=" + id,
          success: function(data) 
          {
              $('.bar' + idTwo).html(data).find(".datepicker").datepicker(
              {
                  inline: true
              });
          }
      });
  }
  </code></pre>