根据 fullcalendar 文档,事件对象可以有一个 id 来唯一标识特定事件的所有实例。
我的问题是:如果我使用 eventClick 选择特定事件,如何自动选择日历上该事件的所有实例?
换句话说,如何仅通过选择其中一个(此)来更改在不同日期发生的同一事件的属性(在本例中为背景颜色)?
我的代码看起来像这样(“newColor”更改所选事件的背景颜色):
eventClick: function(calEvent, jsEvent, view){
$(this).toggleClass('newColor');
}
现在,我的代码仅更改所选事件(此)的颜色。
最佳答案
eventClick: function(calEvent, jsEvent, view){
$(this).toggleClass('newColor');
console.log(calEvent); // "id" if it is set by the event object, will be here.
console.log(this); // is the div element that was clicked on
}
Event Object : 重复事件应该有相同的id。
eventClick :函数(事件,jsEvent, View ){}
关于jquery - 从 fullcalendar 选择事件 ID,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20893297/