I am using fullcalendar plugin for an MVC application and I want to add icon before title. So I am trying element.find('span.fc-title').appendBefore(''); to alter the HTML before rendering. But, here I am getting the error as cannot read property 'find' of undefined. I then checked the callback function parameters and found that I am getting the event properly but element and view as undefined. Following is my code and referred files.
bootstrap.css,
site.css,
core/main.css,
daygrid/main.css,
timegrid/main.css,
Scripts/jquery-{version}.js,
moment/main.js,
core/main.js,
daygrid/main.js,
timegrid/main.js,
interaction/main.js
var calendar = new FullCalendar.Calendar(calendarEl, {
header: false,
plugins: ['timeGrid', 'dayGrid', 'interaction'],
defaultView: 'timeGridDay',
allDaySlot: 'false',
slotDuration: '00:15:00',
editable: 'true',
eventRender: function (event, element, view) {
console.log(event);
console.log(element);
console.log(view);
element.find('span.fc-title').appendBefore('<i class="glyphicon glyphicon-plus" aria-
hidden="true"></i>');
},
events: [
{
title: 'Title 1' ,
start: '2020-05-03T02:30:00Z',
end: '2020-05-03T03:30:00Z'
},
{
title: 'Title 2',
start: '2020-05-03T02:00:00Z',
end: '2020-05-03T03:00:00Z'
},
{
title: 'Title 3',
start: '2020-05-03T03:00:00Z',
end: '2020-05-03T04:00:00Z'
}
]
});
calendar.render();
'''