I need to scroll through a page using anchor tag
.
Right now I'm doing:
<a href="#div1">Link1</a>
<div id='div1'>link1 points me!!</div>
This works fine when I clicked on Link1, the page scrolls to the div with id "div1".
The point is, I do not want to change my URL which takes #div
as suffix once I clicked on Link1
.
I tried with anchor href as
void(0);
and
location.hash='#div1';
return false;
e.preventdefault;
How to avoid changing the URL?