How to change href of tag on button click through javascript
Without having a href, the click will reload the current page, so you need something like this: Or prevent the scroll like this: Or return false in your f1 function and: ….or, the unobtrusive way: