Liquid, JavaScript, themes, sales channels
We would like to call a Javascript function using the Image with Text Overlay section's Button link. The text box for the link entry does not appear to allow such a javascript call to be entered. See image below. Any suggestions you have would be much appreciated.
John
@jfkScollar
You can't. You'll need to create an event listener on that button and, whenever it's clicked, you can call the function you wish.
Kind regards,
Diego
Hi @diego_ezfy,
Thank you for your response.
As the Button's class is generic and there are multiple Buttons that have the same class, how is one to assign an unique ID to the button to create an event listener on that button?
Thanks,
John
Hi @lucas05021,
I haven't. Thanks for asking. Hoping someone has and can post it here.
I'm disappointed that Shopify does not support javascript function calls to be entered for Links (hrefs) in their editor. Javascript function calls in hrefs are such a normal (and powerful) approach to custom functionality.
John
User | RANK |
---|---|
22 | |
22 | |
11 | |
9 | |
7 |
Thanks to all Community members that participated in our inaugural 2 week AMA on the new E...
By Jacqui Mar 10, 2023Upskill and stand out with the new Shopify Foundations Certification program
By SarahF_Shopify Mar 6, 2023One of the key components to running a successful online business is having clear and co...
By Ollie Mar 6, 2023