views:

139

answers:

0

Using jquery-ui datepicker

I would like to use altField and altFormat to 2 datepickers on the same page but I can't figure out how to add these 2 options which are specific to each datepicker along with my common set of options.

Code sample below. #dt1 does not work, but #dt2 works. How can I get #dt1 to work while using the datepickerOpts?

  var datepickerOpts = {
   minDate: -2,
   changeMonth: true,
   changeYear: true,
   dateFormat: 'yy-mm-dd'
  };
  $('#dt1').datepicker(datepickerOpts,
  {altField: '#alt1',
   altFormat: 'mm-dd-yy'
  });
  $('#dt2').datepicker({
   minDate: -2,
   changeMonth: true,
   changeYear: true,
   dateFormat: 'yy-mm-dd',
   altField: '#alt2',
   altFormat: '@'
  });