Posted: December 7, 2015 at 2:27 pm
|
We have a public-facing calendar on which we want to remove the link to actual event page. I’ve got the jquery written to remove the href attribute from a.fc-event, but it won’t work. I’ve tried a window timeout to give the calendar some time to load, but even at 4 seconds, it’s not working. I should add that the events in question are on the January 2016 calendar and it’s currently December 2015. I’m wondering if the timing issue is complicated by the loading of the next month screen… |
Hi Linda, We can take a look at the code you’re trying to use and offer suggestions if you can post it in a pastebin or a gist and link to the code here. |
|
|
Thanks, Josh |
Hi Linda, Here are a few suggestions for how you can have a better time with removing those links: 1) Use JQuery in no-conflict mode and wrap in script tags. 2) Use PHP to conditionally load the script 3) Use the ajaxComplete() method so it waits for the Ajax request to complete. Here’s an example: |
|
|
Sorry, should have said that I pulled the code from inside a js file that runs on the site so the no-conflict mode is taken care of. I can make a special js that only runs on the calendar pages rather than using a conditional inside of the javascript. I’ll have a look at the Ajax shortly. Thanks so much! |
It could still work to be included in a file, and you would still use the ajaxComplete() method for event handling. |
|
|
Thanks Josh – that ajaxcomplete was the answer! Slight changes I made to target the event href and to also switch the cursor so people didn’t think there was supposed to be a link there: ` <script>jQuery( document ).ajaxComplete(function() { |
You will gain some performance if you select by the ID, it’s a lot faster than selecting by class. |
|
|
I’ll try it again, Josh, but the reason I switched was that #espresso_calendar a |
|
It’s working now, Josh – I think our server is doing some caching as I did a hard refresh first and then waited a couple of minutes and did it again. Thanks so much! So for anyone else, the final answer to our issue was: ` <script>jQuery( document ).ajaxComplete(function() { |
The support post ‘Having trouble remove event link on calendar using jquery’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.