I am using jQuery datepicker plugin called PickMeUp .
The datapicker works for me, but I can’t decide how to disable the dates in it. My plan is to have an array of dates to be disabled on the datepicker calendar.
I managed to disable a single date using the documentation from a previous version of the plugin, ( http://www.eyecon.ro/datepicker/ ), but I can't figure out how to add an array of dates to it.
JQuery
$(document).ready(function(){
var now2 = new Date();
now2.addDays(-1);
now2.setHours(0,0,0,0);
$('input#cdate').pickmeup({
position : 'right',
mode : 'range',
render: function(date) {
return {
disabled: date.valueOf() == now2.valueOf()
}
}
});
});
Update
Below is the working code. (Many thanks to Niloct )
$(document).ready(function(){
var arDates = [new Date("2014-02-14").valueOf(),new Date("2014-02-11").valueOf(),new Date("2014-02-09").valueOf()];
$('input#cdate').pickmeup({
position : 'right',
mode : 'range',
render: function(date) {
return {
disabled: arDates.indexOf(date.valueOf()) != -1
}
}
});
});
ss888 source
share