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 params onLoad, however I need to know if there is a way which can enable me to trigger the updation of startDate / endDate Params on some event
Here is the code :
html :
<select id="mySelect"> <option value="2012-2013">2012-2013</option> <option value="2012-2013">2013-2014</option> <option value="2012-2013">2015-2016</option> </select> <input type="text" id="myStartDate" placeholder="dd-mon-yyyy" data-date-format="dd-M-yyyy" readonly="readonly"> js :
var myStartDt = $('#myStartDate') .datepicker({ startDate: getStartDate(), endDate: getEndDate() }).on('changeDate', function (ev) { myStartDt.hide(); }).data('datepicker'); function getStartDate() { var f = $('#mySelect').val().split('-'); return '01/04/' + f[0]; } function getEndDate() { var f = $('#mySelect').val().split('-'); alert(f); return '31/03/' + f[1]; } fiddle : http://jsfiddle.net/fRzyL/1/