Anchor tag with onclick and href='#' scrolls to top

后端 未结 2 1984
心在旅途
心在旅途 2021-01-17 12:14

I have an anchor tag

Register

If you don\'t have a href in you anchor, it can screw

2条回答
  •  星月不相逢
    2021-01-17 12:41

    Use:

     Register
    

    javascript:void(0) will prevent the page from getting redirected and also will fix the issue where your page is getting scrolled on top due to href="#"

提交回复
热议问题