Thanks for the reply
I tried what you suggest. I fetched the dates of events and set in a hidden field and used that array of dates in javascript.
But for some reason, my datepicker is not being triggered. Below is the code that I implemented :-
jQuery(document).ready(function(){
function disableSpecificDates(date) {
var disableDates = JSON.parse(jQuery('.em-date-start').attr('data-event-dates'));
var m = date.getMonth();
var d = date.getDate();
var y = date.getFullYear();
// First convert the date in to the mm-dd-yyyy format
// Take note that we will increment the month count by 1
var currentdate = y + '-' + (m + 1) + '-' + d ;
console.log(currentdate);
console.log(disableDates);
// We will now check if the date belongs to disableddates array
for (var i = 0; i < disableDates.length; i++) {
// Now check if the current date is in disabled dates array.
if (jQuery.inArray(currentdate, disableDates) != -1 ) {
return [false];
}
}
}
jQuery('.em-date-start').datepicker({
beforeShowDay: disableSpecificDates
});
});
Please tell me what I’m doing wrong ?
Thanks