Issue: Tracking Page Script Error (DOM Load Issue)
-
Hi Plugin Author/Support Team,
I am facing an issue with the tracking page in your plugin. The page is throwing the following error in the browser console:
Uncaught TypeError: Cannot read properties of undefined (reading 'addEventListener') at track-order/:1401:68From my investigation, it looks like the JavaScript code is trying to attach an
addEventListenerto an element that is not yet available in the DOM at the time the script runs. Because of this, the element reference becomesundefined/nulland the script fails.Possible causes:
- The script is executing before the DOM is fully loaded.
- The element ID/class used in the script is missing or incorrect.
Possible solutions:
- Wrap the code inside
document.addEventListener("DOMContentLoaded", ...)to ensure the element exists before attaching the event listener. - Add a condition to check if the element exists before calling
addEventListener. - Alternatively, move the script to the footer so it executes after the DOM is ready.
Could you please check and provide a fix in the plugin update?
Thanks & Regards,
Santosh GautamThe page I need help with: [log in to see the link]
The topic ‘Issue: Tracking Page Script Error (DOM Load Issue)’ is closed to new replies.