I am following this jsFiddle to be able to highlight and select whole week from datepicker.
I have customized it to work with jQuery 1.9 by changing .live()
to .on()
. Here is the edited jsFiddle. It works fine but in its current state the week is only highlighted once the user click on a date.
What I want to achieve is to highlight (and populate dates in startDate and endDate vars) the week to which current date belongs automatically on startup without clicking current date. I have tried the following but it doesn't seem to work
var currentDate = $(".week-picker").datepicker("getDate");
var onSelectFunction = $(".week-picker").datepicker("option","onSelect");
var format = $(".week-picker").datepicker( "option", "dateFormat" );
var currDate = $.datepicker.formatDate(format,currentDate)
onSelectFunction( currDate );
Any Suggestions?
See Question&Answers more detail:os