Ecommerce Shopify WordPress Discussion

I'm new at wordpress and don't know why my script isn't working [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. This question does not appear to be about programming within the scope defined in the help center. Closed yesterday. Improve this question I'm new at wordpress and I'm trying to run this script using Divi, but for some reason when I try to trigger the listeners it just redirects me to the page I'm at. The elements with the ids are simply <a id="botonMensual/Anual>...</a> <script> jQuery(document).ready(function($) { // Obtener la URL actual const url = window.location.href; // Variables let tieneVia = false; let via = ""; // Chequeo si tiene via if (url.includes("?via=")) { tieneVia = true; via = url.split("?via=")[1]; // send via to azure } else { tieneVia = false; } // Definición de variables y lógica del script let linkMensual = ""; let linkAnual = ""; if (tieneVia) { linkMensual = "" + via; linkAnual = "" + via; } </script> <script> document.getElementById("botonMensual").addEventListener("click", () => { window.location.href = linkMensual; }); </script> <script> document.getElementById("botonAnual").addEventListener("click", () => {window.location.href = linkAnual;}); }); </script> I tried having all the code under one script tag and without the jQuery(document).ready(function($) line
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.