add a hash to url without scrolling page? with javascript
- i open page
- i scroll down
- i click link that adds a hash (maybe with a value #test) (example: http://www.example.com/#test)
- the page MUST not scroll back to the top.
how can this be done?
note: just checking if it's possible to disable the movement even if there is some tag with id="test" so far the return false; works fine (to support people without javascript), and also to avoid the presence of the id's in the html, but it is not a problem with things like numbers, like 1, 2, 3 (they are not allowed as id's anyway)
all the answers are great, nothing new or groundbreaking, and no solutions on how to break the default functionality, but it will do. :) thank you for taking the time to answer.