How do I reset the datepicker calendar values?.. The min and max date restrictions?
The problem is that when I clear the dates (by deleting the textbox values), the previous date restrictions are still applied.
I've been sorting through the documentation and nothing jumped out as a solution. I also wasn't able to find a quick fix on a SO/google search
http://jsfiddle.net/CoryDanielson/tF5MH/
Solution:
// from & to input textboxes with datepicker enabled
var dates = $("input[id$='dpFrom'], input[id$='dpTo']");
// #clearDates is a button to clear the datepickers
$('#clearDates').on('click', function(){
dates.attr('value', '');
dates.each(function(){
$.datepicker._clearDate(this);
});
});
_.clearDate() is a private method of the DatePicker object. You won't find it in the public API on jQuery UI's website, but it works like a charm.