Reputation: 41
I have this code:
$(document).ready(function () {
/*var event_list = $('#event_list');*//*gil70l*/
//$(document).ready(function () {
//
$("#btnsearch").click(function () {
var res = $("#txtSearch").val();
res = res.substring(0,19);
date = moment(res, "DD/MM/YYYY HH:mm");
alert(date);
$("#calendar").fullCalendar('gotoDate', date);
$('.fc-day[data-date="' + date + '"]').css('background-color', "red");
//$('#calendar').find('.fc-day-number[data-date="' + date + '"]').css('background-color', '#FAA732');
})
but I cannot highlight the day on which I position myself with the function 'gotoDate'.
Upvotes: 2
Views: 187
Reputation: 61983
$('.fc-day[data-date="' + date + '"]'
...in here you'd need to put the date
in yyyy-mm-dd format, as this would match what you see if you look at the generated fullCalendar HTML and see what's there already. Currently you're letting momentJS use its default string format output which would look something like
Wed Aug 25 2021 10:26:36 GMT+0100
I expect that
$('.fc-day[data-date="' + date.format("YYYY-MM-DD") + '"]'
will work better.
Upvotes: 1