Why is my mobile menu not dropping down due to a JS error?

(function() {

    "use strict";

	// Your code here...
	try {

        //////////////////////////////////////////////////////////////////////////////////////////////////////////////
		// Waits for the element to be loaded in the DOM
		//////////////////////////////////////////////////////////////////////////////////////////////////////////////
		function waitForElement(cssSelector, callback) {
            try{
                var elementCached,
                    maxCalls = 300; // [Configurable] Times out after 6 seconds
                var interval = setInterval(function() {
                    elementCached = document.querySelector(cssSelector);
                    // Checks if element 'cssSelector' exists
                    if (elementCached) {
                        clearInterval(interval);
                        callback(elementCached);   << 26
                    }

                    //Take part
                    if(document.querySelectorAll('.get_inspired a[title="Take part to win"]')){
                        document.querySelectorAll('.get_inspired a[title="Take part to win"]')[0].parentNode.classList.add('takepart');  < 355
                    }

Hello,

Seems my mobile menu has stopped working. Doesn’t drop down on mobile - I’m getting the following console error. Uncaught TypeError: Cannot read properties of undefined (reading ‘parentNode’) Line 355 and 26

Any help would be appreciated! Thanks.