Hello, I would like to create an onClick event on one of the buttons in my nav bar, but the properties panel only shows the ID for the whole bar - ‘horizonalMenu1’.
How can I create an onClick event for one button only?
Here is the broader context.
user clicks on button in nav bar
code checks a condition in the database against that userID
if condition is not met, user is sent to an alternative url, rather than the one linked in the nav bar
I suggest you to create your own menu bar and add for each button an onClick() event handler.
At the handler write your condition or just use the wixLocation.to()function to reach to another URL page.
Thank you Sapir. I tried that too, unfortunately the mobile site becomes really impractical. I don’t know how (or if) I could then convert each individual button into the nice 1-icon nav bar that is automatically created on the mobile version of the site.
I was exploring the option on a onAfterSave, so that as soon as the user logs in, I could perform the database check and proceed accordingly.
You can add this event handler, and at the handler write the condition, but its still not going to
impact the Menu Tab Spacing.
As long as you add this menu, any member can reach to any page without a condition.