Javascript 如何在fullCalendar 4中的事件标题中插入HTML?

Javascript 如何在fullCalendar 4中的事件标题中插入HTML?,javascript,jquery,fullcalendar,fullcalendar-4,Javascript,Jquery,Fullcalendar,Fullcalendar 4,如何将HTML插入fullCalendar v4中eventRender中的事件标题 document.addEventListener('DOMContentLoaded', function() { var calendarEl = document.getElementById('calendar'); var calendar = new FullCalendar.Calendar(calendarEl, { plugins: [ 'interaction', 'da

如何将HTML插入fullCalendar v4中eventRender中的事件标题

document.addEventListener('DOMContentLoaded', function() {
  var calendarEl = document.getElementById('calendar');

  var calendar = new FullCalendar.Calendar(calendarEl, {

    plugins: [ 'interaction', 'dayGrid', 'timeGrid', 'list' ],
    header: {
        left: 'title',
        center: 'dayGridMonth,timeGridWeek,timeGridDay,listMonth',
        right: 'prev,next today'
    },
    navLinks: true, // can click day/week names to navigate views
    businessHours: true, // display business hours
    editable: true,
    locale: 'ru',

    events: [
        {
            title: 'Go Space :)',
            description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras eu pellentesque nibh. In nisl nulla, convallis ac nulla eget, pellentesque pellentesque magna.',
            start: '2019-12-27',
            end: '2019-12-27'
        },
        {
            title: 'Dentist',
            description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras eu pellentesque nibh. In nisl nulla, convallis ac nulla eget, pellentesque pellentesque magna.',
            start: '2019-12-29T11:30:00',
            end: '2019-12-29T012:30:00'
        }
    ],
    eventRender: function(event, element) {

        element.find(".fc-title").append('<strong>bla bla bla</strong>');

    },
  });

  calendar.render();
});
document.addEventListener('DOMContentLoaded',function(){
var calendarEl=document.getElementById('calendar');
var calendar=新的完整日历。日历(calendarEl{
插件:['interaction','dayGrid','timeGrid','list'],
标题:{
左:'标题',
中心:“dayGridMonth、timeGridWeek、timeGridDay、listMonth”,
右图:“上一个,下一个今天”
},
navLinks:true,//可以单击日/周名称来导航视图
businessHours:true,//显示营业时间
是的,
地区:'ru',
活动:[
{
标题:“转到空间:)”,
描述:'Lorem ipsum dolor sit amet,是一位杰出的领导者。是一位粗犷的欧洲佩伦斯克人。在nisl nulla,convallis ac nulla eget,佩伦斯克佩伦斯克麦格纳。',
开始:“2019-12-27”,
完:2019-12-27
},
{
标题:“牙医”,
描述:'Lorem ipsum dolor sit amet,是一位杰出的领导者。是一位粗犷的欧洲佩伦斯克人。在nisl nulla,convallis ac nulla eget,佩伦斯克佩伦斯克麦格纳。',
开始:“2019-12-29T11:30:00”,
完:2019-12-29T012:30:00
}
],
eventRender:函数(事件,元素){
元素.find(“.fc title”).append(“bla-bla-bla”);
},
});
calendar.render();
});
此代码在v3中工作,但在v4中不工作

错误:

“无法读取未定义的属性“find”


这是因为1)
元素
未定义,因为v4中
eventRender
的回调签名不同-您检查了吗??错误是告诉您
元素
未定义,因此fullCalendar显然没有将该参数传递给回调。2)v4不使用jQuery,因此您需要使用本机JS函数来操作元素(或者首先将其包装在新的jQuery对象中)。以前也有人问过这个问题,你在网上搜索过以前的问题/例子吗?@ADyson,我没有找到版本4的例子。我以前没有问过。看我的例子,我没有说你以前问过,我说这个话题以前有人问过。“我没有找到版本4的例子”…也许是因为你没有阅读文档?那永远是第一个看的地方。但不管怎样,您刚刚发布的CodePen链接是一个v4示例。因此,如果您正在查看这些内容,我不明白您是如何得到问题中显示的代码的?如果您在谷歌上搜索“fullCalendar v4 eventRender example”,您会得到这样的结果(几个月前由您的Really创建),这应该会让您知道该怎么做。我不知道你在这个问题上做了多少研究。