title: Assign jQuery datepicker to div element and get the value
body: <p>I want to show a datepicker using jQuery when user click on some text, and after the user select the date on datepicker, I can get the value from the date picker as javascript variable. My code is like this:</p>
  
  <pre><code>&lt;div id="datepicker-container" style="display: none;"&gt;
      &lt;div id="select-delivery-date-input"&gt; &lt;/div&gt;
  &lt;/div&gt;
  &lt;a id="show-datepicker"&gt;Select Delivery Date&lt;/a&gt;
  &lt;script&gt;
    $("#show-datepicker").click(function(){
        $("#datepicker-container").show();
    });
    $('#select-delivery-date-input').datepicker({ 
        dateFormat:'yy-m-d',
        minDate: new Date(),
    });
  &lt;/script&gt;
  </code></pre>
  
  <p>The problem is when the datepicker popup, when I tried to select the date on datepicker popup it won't close the datepicker popup.</p>
  
  <p><a href="https://jsfiddle.net/nh6eoj03/372/" rel="nofollow noreferrer">Fiddle example</a></p>