title: Changing minDate and maxDate on the fly using jQuery DatePicker
body: <p>I'm having a particular issue with the jQuery Datepicker. I can easily add a date range, but I want the selectable range to change depending on the event the user has picked.</p>
  
  <p>So if they pick event #1, they can only pick dates from event #1's date range.</p>
  
  <p>I've written a simple little function that gets called whenever the user selects a new event, but it only ever shows the initially set minDate/maxDate values.</p>
  
  <pre><code>function datepicker(startDate, endDate) {
    $( "#date" ).datepicker({
      inline: true,
      minDate: new Date(startDate),
      maxDate: new Date(endDate),
      dateFormat: 'dd/mm/yy' 
    });
  }
  </code></pre>
  
  <p>I've tried calling <code>$('#date').datepicker('remove');</code> before calling the above function again, to see if it creates a new instance with the correct dates, but it doesn't seem to work.</p>
  
  <p>I've checked all the data through developer tools and everything is being called and passed correctly. Is there anything I can do to make this work how I want it to?</p>