Alternative to when the anchor tag only triggers a jQuery action without redirecting the user?

后端 未结 10 1151
走了就别回头了
走了就别回头了 2021-02-09 15:57

I have numerous anchor tags on my page that only trigger jQuery actions on the same page.

The don\'t redirect the user to another location, which is the normal expected

10条回答
  •  误落风尘
    2021-02-09 16:44

    Have you tried omitting the href parameter?

    Link title
    

    That should work just fine and not provoke the browser to load a webpage or change the pages position. In fact it won't do anything unless you have some JavaScript to support it.

    The href parameter is optional so why include it if you aren't using it?

提交回复
热议问题