I am trying to get the \'dayClick\' function to work on FullCalendar, but when I press on any empty day, nothing happens. I have searched all over SO and cannot find any sol
Ran into the same issue when using v4.2.0. Turns out that the interaction plugin wasn't loaded. The event is also now called dateClick instead of dayClick.
A working example is below.
document.addEventListener('DOMContentLoaded', function() {
var calendarEl = document.getElementById('calendar');
var calendar = new FullCalendar.Calendar(calendarEl, {
height: 600,
plugins: [ 'dayGrid', 'interaction' ], // interaction plugin must be specified
dateClick: function(info) {
alert('Clicked on: ' + info.dateStr);
alert('Current view: ' + info.view.type);
// change the day's background color just for fun
info.dayEl.style.backgroundColor = 'red';
},
});
calendar.render();
});