I want to set selected dates in multiDatesPicker using php script which are comma separated values coming from the database. For example, this column 'Dates' having these values '02-05-2018, 15-05-2018, 27-05-2018'. How do I set/show these dates selected in multidatepicker.
<div id="myCalendar"></div>
$("#myCalendar").multiDatesPicker({
});
It's pretty easy, the MultiDatesPicker plugin exposes a method for setting values via the addDates
method:
$('#myCalendar').multiDatesPicker({
addDates: ['5/2/2018','5/15/2018','5/27/2018','6/30/2018']
});
The addDates
method (documentation) states that "the parameter dates can be a string, a date object or an array (of strings or javascript date objects)."
Working jsFiddle here - you'll see June 30th selected as well as May 2nd, 15th & 27th. http://jsfiddle.net/bbrgx3pg/2/