0

私は次の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');
};

それはうまく機能します。

これは階層です:

ここに画像の説明を入力

最初のものが機能していて、これが機能していない理由が本当にわかりません...

ありがとう

4

2 に答える 2

2

次の代わりに、セレクターを変更します。

'#calendar .fc-view-resourceNextWeeks thead th .fc-resourceName'

試す:

'#calendar .fc-view-resourceNextWeeks thead th.fc-resourceName'

于 2013-03-05T15:42:29.020 に答える
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)

最初のものはwith class内の別の要素を探していますが、実際にはその要素が必要です。th.fc-resourceName

于 2013-03-05T15:42:29.963 に答える