Need to highlight range of dates in jquery datepicker -
this question has answer here:
i'm using jquery ui display inline datepicker in have start date , end date. want highlight dates in between them.
you can use jquery ui datepicker beforeshowday function , inside check if date must highlighted according range.
a function takes date parameter , must return array [0] equal true/false indicating whether or not date selectable, 1 equal css class name or "" default presentation, , [2] optional popup tooltip date. called each day in datepicker before displayed.
example:
var date1 = new date(2013, 4, 6); var date2 = new date(2013, 4, 17); $(document).ready(function () { $('#datepicker').datepicker({ beforeshowday: function (date) { debugger if (date >= date1 && date <= date2) { return [true, 'ui-state-error', '']; } return [true, '', '']; } }); });
here working fiddle: http://jsfiddle.net/irvindominin/zz9u4/
Comments
Post a Comment