How not to show #anchor in the URL?

How can I prevent #anchor from going to the URL? I am using pure JavaScript throughout my project.

I would like to see the clear URLs as: ""
I don’t want it like this: ""

<a href="#anchor">

<div id="#anchor">

38 thoughts on “How not to show #anchor in the URL?”

Leave a Comment