0
Prevent anchor tags from reloading the page.
Please does anyone know how to prevent a page from reloading when a user clicks on an anchor tag. I tried using preventDefault() but it doesn't change the URL in the address bar.
4 ответов
+ 1
Can I change the URL in the address bar when a user clicks a button
+ 1
Not clear what do you want.
anchor for the same page but different position, or
totally different page?
In 1st case, use id and #id
In second case if you put href="#" it will not reload
0
Thanks but I'm trying to change the URL in the address bar of the browser not the element. And I want I'm trying to make this happen when the user clicks a button.
0
Trying to change the URL in the address bar dynamically