I am trying to add a class to the .fc-event element via jQuery and it will not apply the class. Is there any reason for this? Do I have to use some type of ajax request to make this happen. Just using the basic code below:



I can add a class to the .fullcalendar containing div, but it won't apply to anything inside that div.

How are you using jQuery to do that? $(document).ready() will not work, because everything inside .fullcalendar is dynamically generated AFTER that. Try using Drupal.behaviors: http://drupal.org/node/171213#behaviors

This still doesn't work...

(function($) {
Drupal.behaviors.calendarItems = function(context) {

Well, that's Drupal 6 syntax for one. Also, when you try the D7 one, if it doesn't work try Drupal.behaviors.ZZZcalendarItems to ensure its not a priority thing.

Ok so I think this is the D7 version based on the link you sent me. Still not working.

Drupal.behaviors.ZZZcalendarItems = {
    attach: function (context, settings) {
      $('.fc-event', context).addClass('testclass');

Is there a special way I need to add this? The javascript file is included via the .info file, and inspecting it shows that the code is included.

Assigned:Unassigned» tim.plunkett

Alright, thanks for spending the time to test that out, I'll have to dig into it more I guess.

Hey Tim, Have you had any time to look into this?

Status:Active» Closed (works as designed)

I have had a similar problem. This due to the weighting order (or lack of) for Drupal.behaviors.

Use the Behavior Weights module to ensure you code is being invoked after FullCalendar has created the calendar in the DOM.