Utilizing the fullcalendar.io plugin, I am trying to inject additional HTML into each cell of the calendar. However, when I check the console, I encounter the following error message:
Uncaught TypeError: Cannot read property 'append' of undefined at Calendar.dayRender (mycode.js?v=1.x:31) at Calendar.publiclyTrigger (main.js?v=1.x:6949) at DayGrid.DateComponent.publiclyTrigger (main.js?v=1.x:4008) at DayGrid._renderCells (main.js?v=1.x:796) at DayGrid.res [as renderCells] (main.js?v=1.x:3189) at DayGrid.render (main.js?v=1.x:740) at DayGrid.Component.receiveProps (main.js?v=1.x:3887) at SimpleDayGrid.render (main.js?v=1.x:1520) at SimpleDayGrid.Component.receiveProps (main.js?v=1.x:3887) at DayGridView.render (main.js?v=1.x:1586)
var calendarEl = document.getElementById('calendar');
var calendar = new FullCalendar.Calendar(calendarEl, {
plugins: [ 'dayGrid', 'timeGrid', 'list' ],
defaultView: 'dayGridMonth',//'timeGridWeek',
header: {
left: 'prevYear,prev,next,nextYear today',
center: 'title',
right: 'dayGridMonth,timeGridWeek,timeGridDay,listWeek'
},
defaultDate: '2019-07-12',
editable: true,
eventLimit: true, // allow "more" link when too many events
dayRender: function(date, element) {
element.append("<input type=\"checkbox\">AM<br>");
}
});
I suspect that the issue lies in the fact that the dayRender function fails to define the elemement variable properly. What might be causing this problem?