我有以下JS功能:JavaScript添加類不工作?
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');
};
那一個工作就好了。
這是層級:
我真的不知道爲什麼第一個是工作,沒有這一條......
感謝
你能告訴我們你在哪裏調用addTopLinks嗎? – 2013-03-05 15:42:05
你爲什麼如此特定目標fc-resourceName? – 2013-03-05 15:42:27
難道你不能只使用[.find()](http://api.jquery.com/find/)? – 2013-03-05 15:42:41