• Resolved stellaractive

    (@stellaractive)


    I’m experiencing a JavaScript error on my staging site that’s preventing other scripts from running. The error occurs in your __main.js file at line 70.

    Error:

    Uncaught TypeError: Cannot read properties of null (reading 'split')
    at __main.js:70

    Issue: The click event listener assumes all anchor tags have an href attribute, but when it encounters an anchor without one (or with an empty href), it throws an error at this line:

    javascript

    let navigationToElement = document.getElementById(a.getAttribute('href').split('#')[1]);

    Impact: This error stops all subsequent JavaScript on the page from executing, including our custom scripts.

    Suggested Fix: Add a null/validity check before the .split() call:

    javascript

    let href = a.getAttribute('href');
    if (!href || !href.includes('#')) {
        return;
    }
    let navigationToElement = document.getElementById(href.split('#')[1]);

    Could you please fix this in the next update or advise on a workaround?

Viewing 1 replies (of 1 total)
  • Plugin Support Laca

    (@lacadev)

    Hi @stellaractive

    Thanks for reporting this. We’ve fixed the JavaScript error you mentioned, and the issue is resolved.

    Kind regards,
    Laca from Trustindex

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.