Streaming live at 10am (PST)

Trigger Button Click

Hello Forum,

I want to trigger a Webflow button to open the Calendly Popup. I tried it with ID but then I can only use one Button. And I tried it with the Selector/Class same Problem. How can I code it that the whole Site only need one Code? Maybe for every Page??

I used these scripts:

<!-- Calendly Link-Widget Beginn -->
<link href="https://assets.calendly.com/assets/external/widget.css" rel="stylesheet">
<script src="https://assets.calendly.com/assets/external/widget.js" type="text/javascript"></script>
<!-- Calendly Link-Widget Ende -->


<script>
(function clickMe() {
  const button = document.querySelector('.buttonappointment.tb.le');
  button.addEventListener("click", event => {
    // 🧠 your onClick script...
    Calendly.initPopupWidget({url: 'https://calendly.com/profi24'});return false;
  });
})();
</script>

And this:

(function clickMe() {
  const button = document.getElementById("button");
  button.addEventListener("click", event => {
    // 🧠 your onClick script...
    alert("button clicked");
  });
})();