So I have a fullCalendar (v.4.2.0) instance in my page (loaded/built on document.ready) and I want to access that fullCalendar instance in other functions to add events dynamically.
Using $('#calendar').fullCalendar('getView')
it shows an error that the fullCalendar() method does not exist:
$(...).fullCalendar is not a function
How can I access that instance?
The code that I'm using to generate the calendar is the following:
var calendarEl = document.getElementById('calendar');
var calendar = new FullCalendar.Calendar(calendarEl, {
plugins: [ 'timeGrid', 'dayGrid' ],
defaultView: 'timeGridWeek',
height: 700,
locale: 'pt',
allDaySlot: false,
handleWindowResize: true,
events: [
{
title: 'Teste1', // a property!
start: '2019-07-23 16:00',
end: '2019-07-23 17:00',
backgroundColor: '#fcba03',
borderColor: '#fcba03',
}
]
});
calendar.render();