Prevent `<a>` tags from redirecting
I am trying to create a single-page application with a music player. That’s why I want to prevent <a> tags from redirecting, which in turn causes the player to stop. I tried several approaches such as: document.addEventListener(‘click’, event => { if (event.target.tagName === ‘A’) { event.preventDefault(); navigate(event.target.href); } }); or document.addEventListener(‘DOMContentLoaded’, () => { const… Read More Prevent `<a>` tags from redirecting