For some reason ----- I am having the hardest time with buttons lately.
Sunday — my site was working fine. YESTERDAY ---- some buttons don’t redirect when clicked.
I added buttons to a side/hamburger menu using code. When I hover over them … the URL shows up at the bottom of my screen. When I click them … nothing happens.
I had to add a regular wix menu in my header (which I did NOT want to do).
I had someone in a different State test it out for me, and she was not able to get them to work.
I had someone in a different COUNTRY test it out for me, and he said it DID work for him.
Have had similar issue and it can be quite frustrating to figure out… it may have been coincidence but i ended up abandoning i.e. #button7 and replaced it with a new one then updated script accordingly …and viola! it worked again… bugs creepy bugs
In the video you mentioned that you code the side menu to close on a button click.
Is there any chance that these buttons have both an ‘onClick’ function and a link to go to?
If so, consider the browser behaviour, upon click:
“Should I do the click first?!”, “Should I go to a link?”, “Maybe both?”, “I don’t know! :O”
So having two different behaviours is not that good.
If it is the case, remove the link and ,on the ‘onClick’ function, just use wixLocation.to() to wrap it up.
Hi Liran, may indeed be the case. I say in the generated code, the items are ‘div’ so my guess these are not ‘buttons’, the login is and that works. I tried it and with me the other items didn’t work. I hadn’t gotten to seeing what would happen if I changed div in to button (all in the generated code). If I’m correct a real button () is different the a click of a
. There are different events.
Maybe Nayeli can say what sort of element is used for those entries, and answer your comment.
Yup … they are all buttons. Great observation Edgar — and very strange that it did NOT detect them as such. Hmmmmmm …
Thanks guys ---- Let me code it up then lol. It makes sense ---- trying to connect 2 different ways might have confused the poor buttons. I’m going to have to revisit my other form that was having the same problem …
Oh — just in case ---- for anyone else that was having trouble with their buttons. Since I had added onClick code for those buttons AND they were linked to pages by using the button link icon … it was confusing the button a little and didn’t know what to do.
So I added just 1 more link of code so the button knew where to go after someone clicked on it. It looks something like this:
import wixLocation from 'wix-location';
export function homeButton_click() {
$w("#menuDesktop").hide();
wixLocation.to(`/home`);
}
if ‘home’ is set to your home page you needn’t add it, you can use ‘/’. This way if you switch to home2 or ‘in progress’ as home page the link still goes to the home page (root of the site) Also I’ld watch the quotes. Here your quotes are note the same as with wix-location
Just noticed a similar issue - buttons in my header stop working AFTER a access a dynamically generated page. That is, they work as expected and forward to the target pages UNTIL I access a dynamic page. Then they stop working although they still highlight and appear selectable.
They have confirmed they know about the issue and it’s on wix end and are fixing it (nearly a week now and still not fixed) pretty major i think if dynamic pages aren’t loading.
If you have buttons or elements in the header or footer it is also crucial you put the scripts connected to those elements in site code and not in page code. Have you checked this?
The buttons had links connected through the button AND code. Wix said it’s either all code or none at all (not half & half). It worked fine after that.
Ok, that’s true, every element that supports linking to other pages/resources can’t have two event handlers on the same. That was one of one issues as well in a project.