https://fullcalendar.io/docs/destroy
FullCalendar Code:
document.addEventListener('DOMContentLoaded', function () {
var calendarEl = document.getElementById('calendar');
var calendar = new FullCalendar.Calendar(calendarEl, {
plugins: ['interaction', 'dayGrid', 'timeGrid'],
defaultDate: new Date(),
navLinks: true,
selectable: true,
selectMirror: true,
draggable: true,
editable: true,
eventLimit: true,
events: [
<?= $contents ?>
],
});
calendar.render();
});
FullCalendar v4.2 destroy is not working I tried the below,
1. var calendarEl = document.getElementById('calendar');
calendarE1.destroy();
2. $("#calendar).destroy();
3. calendarEl = document.getElementById('calendar');
var calendar = new FullCalendar.Calendar(calendarEl, {
plugins: ['interaction', 'dayGrid', 'timeGrid'],
});
calendar.destroy();
These things I tried but nothing helps!.
Note: I am trying to destroy the calendar in ajax success.
My Objective is I need to destroy the old events and reinitialize by new events.