How do I attach a handler to the navigation buttons in FullCalendar v4? There is nothing specified in the official documentation.
The only build-in method is the events: fn ()
callback. From the docs
FullCalendar will call this function whenever it needs new event data. This is triggered when the user clicks prev/next or switches views.
document.addEventListener('DOMContentLoaded', function() {
var calendarEl = document.getElementById('calendar');
var calendar = new FullCalendar.Calendar(calendarEl, {
plugins: [ 'dayGrid' ],
defaultView: 'dayGridMonth',
events: function (info) {
console.log(info);
}
});
calendar.render();
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With