我有以下JS功能:
function addTopLinks() {
$('#calendar .fc-view-resourceNextWeeks thead th .fc-resourceName')
.addClass('top-cell');
};
没有添加课程。
我有另一个:
function addDayClass() {
$('#calendar .fc-view-resourceNextWeeks thead th')
.filter(function () {
if ($(this).text().indexOf('Mon ') == 0) return true;
return false;
})
.addClass('monday');
};
那个工作得很好。
这是层次结构:
我真的不确定为什么第一个工作而不是这个......
由于
答案 0 :(得分:2)
更改您的选择器,而不是:
'#calendar .fc-view-resourceNextWeeks thead th .fc-resourceName'
尝试:
'#calendar .fc-view-resourceNextWeeks thead th.fc-resourceName'
答案 1 :(得分:1)
$('#calendar .fc-view-resourceNextWeeks thead th .fc-resourceName').addClass('top-cell');
应该是
$('#calendar .fc-view-resourceNextWeeks thead th.fc-resourceName').addClass('top-cell');
(请注意删除th
和.fc-resourceName
之间的空格
第一个是在th
中使用类.fc-resourceName
查找另一个元素,而实际上您需要该元素。