Export to GitHub

jquery-datepicker - issue #376

how to set the selected dates in datepicker with selectMultiple enabled?


Posted on Aug 21, 2013 by Massive Lion

I use following script to create and dpSetSelected set 2 dates in datepicker, I wish the datepicker will appear with the 2 dates selected. But it does not work. Could you tell me what's wrong with it? $(function() { $('#inline-1') .datePicker( { showYearNavigation:false, inline:true, selectMultiple:true // allow multiple dates to be selected } ); });

$('#indine-1').dpSetSelected("2013-08-22");
$('#indine-1').dpSetSelected("2013-08-23");

Please see the attachment file. Thanks.

Attachments

Comment #1

Posted on Sep 2, 2013 by Happy Giraffe

You need to use the correct date format when you call dpSetSelected...

I just visited this page in Chrome: http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/datePickerMultiple.html

Then I entered these two lines into the javascript console:

$('.date-pick').dpSetSelected('09/09/2013'); $('.date-pick').dpSetSelected('11/09/2013');

Then I opened a date picker and both dates were shown as selected...

Status: Invalid

Labels:
Type-Defect Priority-Medium