0

I have the following JS function:

function addTopLinks() {

    $('#calendar .fc-view-resourceNextWeeks thead th .fc-resourceName')
 .addClass('top-cell');
};

It is not adding the class.

I have another:

function addDayClass() {
    $('#calendar .fc-view-resourceNextWeeks thead th')
        .filter(function () {
            if ($(this).text().indexOf('Mon ') == 0) return true;

            return false;
        })
        .addClass('monday');
};

That one works just fine.

This is the hierarchy:

enter image description here

I am really not sure why the first one is working and not this one...

Thanks

3
  • Can you show us where you call addTopLinks? Commented Mar 5, 2013 at 15:42
  • why are you being so specific to target fc-resourceName ? Commented Mar 5, 2013 at 15:42
  • Can't you just use .find()? Commented Mar 5, 2013 at 15:42

2 Answers 2

2

Change your selector, instead of:

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

try:

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

Sign up to request clarification or add additional context in comments.

Comments

1
$('#calendar .fc-view-resourceNextWeeks thead th .fc-resourceName').addClass('top-cell');

should be

$('#calendar .fc-view-resourceNextWeeks thead th.fc-resourceName').addClass('top-cell');

(Note the removal of the space between th and .fc-resourceName)

The first one is looking for another element inside the th with class .fc-resourceName, while you actually want that element.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.