I would suggest not using the anchor tag at all. If you do not want the HREF value, then this is really not a link to another page, so itโs probably not really a link. If the site should be accessible without javascript, you need to think about it also and come up with a solution that will allow you to get the true href value, which will refer to the actual content.
However, if you are ok with the fact that this application requires JS, you can do this:
<a href="javascript:;" onclick="somefunction(); return false;">
But, again, this is really what you click to update the interface, and not go somewhere, so I just make it a DIV, give it an onclick event and do it. But be sure to give the tabindex div so that it can be accessed by the keyboard.
source share