datepicker common options but different altField altFormat

Posted by Legio X on Stack Overflow See other posts from Stack Overflow or by Legio X
Published on 2010-05-29T04:20:59Z Indexed on 2010/05/29 4:22 UTC
Read the original article Hit count: 230

Filed under:
|

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: '@'
  });

© Stack Overflow or respective owner

Related posts about jquery-ui

Related posts about datepicker