Scroll to the element:
document.querySelector('#test').scrollIntoView();
Question
I want to make the browser to scroll the div's id
<div id="test">
lol
</div>
So I use this code
window.location = "#test";
but my url now is like this
http://locahost/index.html#test
Is it possible to delete "#test" but go to that ?
Solution
Scroll to the element:
document.querySelector('#test').scrollIntoView();