Ecommerce Shopify WordPress Discussion

Problem with adding additional attributes to the button in WordPress editor

I have a problem with adding extra attributes to the button. I want to add this attribute to the button: onclick=currentDiv(1, 'color') but in reality when i submit the changes and check it in the code i get onclick=currentDiv(1," 'color') instead. Im using avada theme editor and avada button. I tried to make a code block and create a simple html button <button onclick="currentDiv(1, 'color')">Color 1</button>and it works fine
I checked the documentation for the Avada button, and it doens't explicity say you can't add an onclick attribute, but in the example of attributes you can add it gives: rel='nofollow'. Based on that, and the fact that it is clearly HTML-encoding the apostrophes, I'd say you need another method to listen for the click event on this button. So what I would do here, is give the button a unique CSS Class (different from any class used in the whole site, so something like "eksport-currentdiv". Next, add some custom javascript. You can add this into the page with Avada's "Code Block" element. This should do what you want: <script> (function($){ $(document).ready(function(){ $('.eksport-currentdiv').on('click', function(){ currentDiv(1, 'color') }); }); })(jQuery); <script>

January 20, 2024

TurboCommerce make the better internet purchasing globaly

Turbo Multi-language Translator

Make the better internet purchasing globaly

Turbosify SEO Speed Booster

5.0 (7) Free plan available
Get better conversions by improving store loading speed Installed

Turbo Multi-language Chat - AI Customer service in one hand

TurboCommerce make the better internet purchasing globaly
Our products

The help you need, when you need it

App by Turbo Engine

3 apps • 5.0 average rating

Turbosify Speed Booster

5.0 (7)
Get better conversions by optimizing shopify store Google page speed Installed

Turbosify Translator for Wordpress Woocommerce

5.0 (74) Free Wordpress Woocommerce Plugin
Translate your wordpress website to multiple language within 1 click, no configuration needed, no No technical required

Grow your business here

Whether you want to sell products down the street or around the world, we have all the tools you need.