What I am trying to do :
I am trying to set the startDate and endDate params depending on the current value of year. I think that currenty what I have just sets the
Change the values of option
2013-2014 and 2015-2016 like
<select id="mySelect">
<option value="2012-2013">2012-2013</option>
<option value="2013-2014">2013-2014</option>
<option value="2015-2016">2015-2016</option>
</select>
Change this to js,
var myStartDt;
function mydatepicker(){
myStartDt= $('#myStartDate')
.datepicker({
startDate: getStartDate(),
endDate: getEndDate()
}).on('changeDate', function (ev) {
myStartDt.hide();
}).data('datepicker');
}
$("#mySelect").on('change',function(){
// alert(this.value)
$('#myStartDate').datepicker("remove");
mydatepicker();//$('#id-element').datepicker("destroy");
});
mydatepicker();
Fiddle
I think you can simply use setStartDate
and setEndDate
methods: http://jsfiddle.net/ivkremer/fRzyL/21/