I have a modal that displays on a click event on my page. I've added an event listener to the 'close' link element in the top right of the modal, code as follows:
document.querySelector('.modal__close').addEventListener('click', () => {
modal.style.display = 'none'
})
This does indeed close/remove the modal, however, it also causes the page to 'jump' back up to the top (I've noticed it also adds a '#' to the end of the url), which is not the behaviour I want, how would I get the modal to just gracefully disappear and leave the underlying display exactly the same?