In my fullcalendar v4.3.1 app I want to add some buttons with jsvascript function to eventsexample with decision I make it as :window.calendarEventsObject = new FullCalendar.Calendar(calendarEl, { plugins: ['dayGrid'], eventRender: function (eventInfo) { eventInfo.el.querySelector('.fc-title').append("<i class='fa fa-external-link pull-right'>7890</i>"); // I see text in title , but not html element, as I expected // eventInfo.el.querySelector('.fc-title').html("<i class='fa fa-external-link pull-right'>7890</i>"); // If to uncomment the lline above I got error eventInfo.el.querySelector(...).html is not a function }, events: eventsList, showNonCurrentDates: false, editable: true, allDaySlot: true, selectable: true, selectHelper: true, selectOverlap: false, fixedWeekCount: false, aspectRatio: 0.4, height: 700,});Which way is valid ?Thanks! 解决方案 The ".html is not a function" error occurs because .html is a jquery function and el is not a jQuery object (as of fullCalendar 4).And .append() only appends plain text, not HTML. This is mentioned in the documentationIf you want to append a HTML string then the simplest way is to use innerHTML:eventRender: function (eventInfo) { eventInfo.el.querySelector('.fc-title').innerHTML += "<i class='fa fa-external-link pull-right'>7890</i>";}Demo: https://codepen.io/ADyson82/pen/JjPJXeb 这篇关于Fullcalendar v4活动中的“添加"按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
07-29 12:04