How do I get multimonth plugin of the jQuery datePicker to load with certain dates already selected?

Posted by imHavoc on Stack Overflow See other posts from Stack Overflow or by imHavoc
Published on 2009-09-21T01:58:50Z Indexed on 2010/04/20 6:03 UTC
Read the original article Hit count: 375

Filed under:
|
|

well im using this script right here:
http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/

and I have a multiMonth plugin and multiple select enabled.

I want to be able to on load have certain dates already selected and those dates come from a database
I found two possible clues to help me out, but since I have not strictly learned JS yet, I can not made heads or tails.
http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/renderCalendarBankHolidays.html http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/datePickerDefaultToday.html

here's the code right now im using:

<script type="text/javascript" charset="utf-8">
   jQuery(function() {
      jQuery('#multimonth').datePickerMultiMonth({
         numMonths: 12,
         inline: true,
         selectMultiple: true,
         startDate: '01/09/2009', // DD/MM/YY
         month: 8, // 0=JAN  1=FEB ...
         year: 2009
      }).bind(
         'dpMonthChanged',
         function(event, displayedMonth, displayedYear) {
          //uncomment if you have firebug and want to confirm this works as expected...
          //console.log('dpMonthChanged', arguments);
      }).bind(
         'dateSelected',
         function(event, date, jQuerytd, status) {
         //uncomment if you have firebug and want to confirm this works as expected...
         //console.log('dateSelected', arguments);
      }).val(
         new Date().asString()).trigger('change');
      jQuery('#getSelected').bind(
         'click',
         function(e) {
            alert(jQuery('#multimonth').dpmmGetSelected());
            return false;
      });
   });
</script>

and this part is not being selected, I took it from the select todays date demo

.val(new Date().asString()).trigger('change');

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about datepicker