I’m working on a webpage that needs to display different Calendly booking widgets based on user selection. When someone picks a different person from a dropdown or list, I want to update the calendar widget to show that person’s availability.
The problem I’m facing is that after I change the data-calendly-url attribute with JavaScript, the widget doesn’t refresh automatically. It still shows the old calendar from the previous selection.
What’s the proper way to modify the URL attribute and force the Calendly widget to re-render with the new booking link? Do I need to reinitialize the widget somehow or is there a specific method to call?
Calendly doesn’t track attribute changes after it loads initially. I ran into this exact issue and found that completely removing and recreating the widget element works way better than just clearing innerHTML.
This stops any leftover event listeners or cached data from messing with the new widget. I’ve seen clearing innerHTML leave behind Calendly’s internal references, which causes display problems. Replacing the entire DOM element gives you a clean slate every time.