javascript - jquery datepicker - add class to first 17 days -
is there way give class first 17 days on jquery datepicker calendar?
i have tried seems add class every day...
beforeshowday: function(date) { (i = 0; < 17; i++) { return [true, 'myclass']; } return [false, '']; }
edit:
i've managed following code:
beforeshowday: function (date) { if (date <= new date().setdate(new date().getdate()+17) && date >= new date() ) { return [true, 'myclass']; } return [true, '']; }
the problem doesn't give class todays date. ideas why?
maybe like:
beforeshowday: function(date) { var today = new date(), maxdate; today.sethours(0,0,0,0); maxdate = new date().setdate(today.getdate() + 17); if (date <= maxdate && date >= today ) { return [true, 'myclass']; } return [true, '']; }
Comments
Post a Comment