I have a page with links that open a modal with id="modal-i
(where i
is any number) linked to an anchor tag with href="#modal-i"
. This works fine, you click the link and the associated modal will pop up, then when a link with href="#"
is clicked the modal disappears.
I was wondering if there was a way to hide the hash location but keep the modal open? Basically keep everything working the same and just hide the hash in the URL.
I know that the only reason the modal will pop up is BECAUSE the hash is in the URL, but still wondering if it was possible, as it would make everything much cleaner.
I have searched for the answer but all I have found are questions asking how to remove the hash location with no page-reload.
Any help is greatly appreciated, thank you!