Title: JavaScript Error in __main.js Blocking Other Scripts
Last modified: January 14, 2026

---

# JavaScript Error in __main.js Blocking Other Scripts

 *  Resolved [stellaractive](https://wordpress.org/support/users/stellaractive/)
 * (@stellaractive)
 * [4 months, 3 weeks ago](https://wordpress.org/support/topic/javascript-error-in-__main-js-blocking-other-scripts/)
 * 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:**
 *     ```wp-block-code
       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
 *     ```wp-block-code
       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
 *     ```wp-block-code
       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](https://wordpress.org/support/users/lacadev/)
 * (@lacadev)
 * [4 months, 2 weeks ago](https://wordpress.org/support/topic/javascript-error-in-__main-js-blocking-other-scripts/#post-18791970)
 * Hi [@stellaractive](https://wordpress.org/support/users/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](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fjavascript-error-in-__main-js-blocking-other-scripts%2F%3Foutput_format%3Dmd&locale=en_US)
to reply to this topic.

 * ![](https://ps.w.org/wp-reviews-plugin-for-google/assets/icon-256x256.png?rev
   =2721569)
 * [Widgets for Google Reviews](https://wordpress.org/plugins/wp-reviews-plugin-for-google/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-reviews-plugin-for-google/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-reviews-plugin-for-google/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-reviews-plugin-for-google/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-reviews-plugin-for-google/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-reviews-plugin-for-google/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Laca](https://wordpress.org/support/users/lacadev/)
 * Last activity: [4 months, 2 weeks ago](https://wordpress.org/support/topic/javascript-error-in-__main-js-blocking-other-scripts/#post-18791970)
 * Status: resolved