I allocate a few days a month depending on the data coming from the backend. When I cgenge a month or a year, again I call an ajax call. But datepicker only shows previous dates. My code is as follows:
$("input.dC").live('click',function() { $(this).datepicker({ showOn:'focus', changeMonth:'true', changeYear:'true', onChangeMonthYear:function(year,month,inst) { var date = new Date(year,month-1); obj.suggestDates(date); $("#"+inst.id).datepicker("refresh"); }, beforeShowDay:function(date){ for(i=0;i<obj.r.length;i++) { var m = obj.r[i]; if(date.getMonth() == m[1] && date.getDate() == m[0] && date.getFullYear() == m[2]) { return[true,"ui-state-highlight"];} } return[false,""]; } }).focus(); }); obj.prototype.suggestDates=function(d){
source share