jQuery error (frontend.js): $link.on is not a function
-
I installed the ‘Ecwid Ecommerce Shopping Cart’ plugin and am getting a jQuery error: in frontend.js: ‘$link.on is not a function’ and my WordPress drop-down menus don’t work any more.
I found that if I comment out in frontend.js:
$link.on('click', function() { if (typeof Ecwid == 'undefined') { return true; }my drop down menus are appearing again – is there any native fix for this since this looks like a simple coding error of something that is not defined (‘$link’) in frontend.js.
Any help would be greatly appreciated.
-
Quick update:
I found that if I re-write to:
$link.click(function() { if (typeof Ecwid == 'undefined') { return true; }the javascript error goes away and WordPress dropdown menus function again.
Could the frontend.js be re-written to include this change since I think the call in the current frontend.js:
$link.on('click', function() {has been deprecated.
If I change the source code of frontend.js myself it will be overwritten with every plugin update which is not a viable option.
Could you update frontend.js accordingly? Please let me know at your earliest convenience since I would like to use your cart system.
Hi @andi_sf!
This is Ilnur from Ecwid team.
Thanks for reaching us!
The on() method hasn’t been deprecated. You can check the official docs here – https://api.jquery.com/category/deprecated/. The .click() method is a shortcut for .on( “click”, handler ) only. So I think the problem is elsewhere.
We need more details to investigate this issue. Can you post a link to the page where this didn’t work so we can look directly?
Hi Ilnur,
thanks for the quick reply – let try to post a dev site for you to take a look in the next few days…
Is there a way I don’t have to post the link publicly?
All the best,
-andreasIs there a way I don’t have to post the link publicly?
Yes, please email us at [email protected] and add the link on this forum thread for a faster response.
Thank you,
-
This reply was modified 3 years, 10 months ago by
Ilnur Basyrov.
We’ve got your email. Thank you!
We’re looking at this issue and will reply soon.
Thanks Ilnur – I am looking forward to hearing from you…
Hello,
I quickly wanted to follow up on the jQuery error issue. Could you let me know if the frontend.js could just be updated from your side with the code:
$link.click(function() { if (typeof Ecwid == 'undefined') { return true; }that does not throw the error so that the plug-in could be updated in the future without concerns about this issue. Since the above code is just a different way to write the function and not a major modification I hope that this will be possible.
Please let me know since I have need to know which 3rd part shopping cart solution to recommend/use.
Thanks in advance.
Hi, @andi_sf!
Thank you for your patience. We’ll try to fix this issue in the next release.
Regards,
Hi, @andi_sf
We have some updates about this issue. We found the cause of this problem.
Method .on() was introduced in jQuery 1.7, but it looks like you are running 1.5.2. For your information — version 1.5.2 has last updated in 2011.
We find that the “wp-prettyphoto” plugin loads this old version of jQuery on your website pages. This plugin has been closed and is not updated for 12 years https://wordpress.org/plugins/wp-prettyphoto/. Are you still using this plugin?
The issue might fix if you’ll disable the “wp-prettyphoto” plugin. Could you try to do it?
Hi Ilnur,
thanks for hanging in there with me. Let me just say that support at Ecwid is stellar and very prompt and focused!
I went ahead and put in the original frontend.js file and disabled the WP-prettyPhoto plug-in with no effect – the sub-menus still would not show. Then I went ahead and selectively turned every plug-in off, checked and then on again but with no effect – drop-down menus would not show.
Menus work again when I make the small frontend.js modification:
$link.click(function() { if (typeof Ecwid == 'undefined') { return true; }So it looks like the frontend.js still looks like the main source of the issue.
@meteor1ecwid I’ve deleted your offer to login to your user’s site. I’m am 100% sure you mean well but please never ask for credentials on these forums.
Now for the why: The internet is a wonderful place full of very nice people and a few very bad ones. I’m sure everyone here is very nice however, by giving some ones keys to your house you are trusting they wont steal anything. Likewise the person who takes the keys is now responsible for the house FOREVER.
If something was to go wrong, then you the author may well legally become liable for damages, which they would not normally have been as their software is provided without warranty.
Please be aware that repeatedly asking for credentials will result in us escalating this to the plugins team.
It’s never necessary to do that. Here’s why.
There are many ways to get information you need and accessing the user’s site is not one of them. That’s going too far.
- Ask for a link to the https://pastebin.com/ or https://gist.github.com log of the user’s web server error log.
- Ask the user to create and post a link to their
phpinfo();output. - Ask the user to install the Health Check plugin and get the data that way.
- Walk the user through enabling WP_DEBUG and how to log that output to a file and how to share that file.
- Walk the user through basic troubleshooting steps such and disabling all other plugins, clear their cache and cookies and try again.
- Ask the user for the step-by-step on how they can reproduce the problem.
You get the idea.
Volunteer support is not easy. But these forums need to a safe place for all users, experienced or new. Accessing their system that way is a short cut that will get you into real trouble in these forums.
Hey @sterndata!
Thank you for your notice. I will try not to repeat this.
Hi @andi_sf
We’ve released a new plugin version 6.10.26 which includes improved compatibility with older versions of jQuery (<1.7) for the dropdown menu.
Feel free to update the plugin on your website.
Regards,
Hi Ilnur,
thank you very much for your message.
I updated the plugin to the new version but unfortunately this messed up the whole store layout. Fortunately I had a backup of the old plugin version so that I could re-install and then everything displayed correctly again.
Just my simple 1 line change from above accomplishes the task though … this is quite baffling… do you any suggestions?
Hi, @andi_sf
Sorry for the trouble. Version 6.10.26 had a bug.
We have released a new version 6.10.27 with fixes for the problem now. Please feel free to update.
-
This reply was modified 3 years, 10 months ago by
The topic ‘jQuery error (frontend.js): $link.on is not a function’ is closed to new replies.