I'm facing an issue on my website that's causing the following error message to pop up:
Uncaught TypeError: Cannot read property 'classList' of null at HTMLImageElement.
Here's the code I've been using:
Despite searching on other websites, I haven't been able to find a suitable solution for this problem.
The issue seems to be related to this portion of the code:
<script>
var menu = document.getElementById('menu');
var nav = document.getElementById('nav');
var exit = document.getElementById('exit');
menu.addEventListener('click', function(e) {
nav.classList.toggle('hide-mobile');
e.preventDefault();
});
</script>