Inset onclick event to button

Hi Guys.

I have the following function for calendly. I’m not too good at JS. I have my button with an ID of btnBook, and I am trying to add an on click event:

I have the following js code

$(document).ready(function() {
$(’#btnBook’).click(Calendly.initPopupWidget({url: ‘https://calendly.com/test’}));
});

This doesn’t appear to work (I have the scripts loading in the header)

Any ideas?

I can get it this way, but there must be an easier solution with jquery?

var calendyButton = document.getElementById(‘btnBook’);
calendyButton.addEventListener(“click”, function() {
Calendly.initPopupWidget({ url: ‘https://calendly.com/test/meeting-30-minutes’ });
return false;
})

Hi Hayden,

It seems that you are having issues with custom coding. Answering the custom code issue is beyond the scope of theme support. I would suggest you hire a developer who can assist you to do the customization or you can avail of our newly launched service called One, where we answer the questions beyond normal theme support.

Thanks

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.