Hey @dsac
From the error I can see that you added @talyaro 's code inside the onReady function for your page. You can’t copy paste all of her code because it includes some code the system needs to create for you automatically, and it can’t exist inside the onReady.
What you need to do is the following, in this order:
- Set up the page as Tova explained.
- Add the event handlers using the properties panel - this will add a function to your code panel underneath your onReady function.
- Inside the function that gets created, which will start with “export function”, under where it says “//Add your code for this event handler here:” Add the code @talyaro gave you but just these lines:
$w('#googleEventCalendar1').show();
$w('#googleEventCalendar2').hide();
$w('#googleEventCalendar3').hide();
You don’t want to copy the line that starts with “export” because we automatically make it for you when you add the event handler using the properties panel.
4. For each button’s event handler, you need to switch which calendar you are showing or hiding. So for the button for calendar 2 the code would be:
$w('#googleEventCalendar1').hide();
$w('#googleEventCalendar2').show();
$w('#googleEventCalendar3').hide();
If you are going to work with this functionality I would strongly recommend (read “it’s critical”) you read this article: Velo: Reacting to User Actions Using Events | Help Center | Wix.com. It will give you a good understanding of how and why all this works and help you avoid some common mistakes.
- Jeff