Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
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:
$('.fc-event').addClass('test');
Comments
Comment #1
jsheffers CreditAttribution: jsheffers commentedI can add a class to the .fullcalendar containing div, but it won't apply to anything inside that div.
Comment #2
tim.plunkettHow 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#behaviorsComment #3
jsheffers CreditAttribution: jsheffers commentedThis still doesn't work...
Comment #4
tim.plunkettWell, 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.Comment #5
jsheffers CreditAttribution: jsheffers commentedOk so I think this is the D7 version based on the link you sent me. Still not working.
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.
Comment #6
tim.plunkettAlright, thanks for spending the time to test that out, I'll have to dig into it more I guess.
Comment #7
jsheffers CreditAttribution: jsheffers commentedHey Tim, Have you had any time to look into this?
Comment #8
slcp CreditAttribution: slcp commentedI 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.