How do I use onClick to call a function in javascript

Hi, I am using a button to open a reservation tool for a weekly event. We only take reservations from noon Monday thru noon Friday but the reservation tool does not have the capability to set a start time, so I have to update the link every Monday around 11:55am. I’ve written a javascript function that
pops up a lightbox with an error message when the button is clicked between Friday at noon and Monday at noon that works in WordPress, but I am having problems getting it to work in WIX.

I’m getting a " ‘massReservation’ not defined" error on line 36. I’m pretty sure it has something to do with my syntax for the “onClick” section of the script. I’ve been working on this for a few hours and cannot find any refernce on using onClick to call a function.
Thanks in Advance,
Monte

Hello! you called the onClick() function twice, your code should look like this

export function massReservation_click(event){
        massReservation();
  }

Sorry, but that still does not work. I’m still getting the " ’ massReservation’ is not defined" error.

oh I see, that is because the function massReservation() has to be declare outside the $w.onReady function. Try the following format.

$w.onReady(function () {
 
}); 

function massReservation  () {
        console.log("Now it should work");
    }



export function massReservation_click(event) {
    massReservation(); 
}

You’re right. Moved the }); where they belonged and it works.
Thanks for your help

Did you find the answer Monte?