I assume you want a piece of text change when you click it. Not sure what exactly you want to achieve, but you most likely don't need the <a>
element for this.
Make a <span>
, <div>
or <button>
element, style it with css and add your onclick event handler there.
<span role="button" tabindex="0" class="styleMe" onclick="changeContent('frontmain');">Home</span>
The "role" attribute helps to clarify the intended use as a button for accessibility.
The "tabindex" attribute allows to navigate to this action without using a mouse.
You probably want to set the cursor css attribute in your styling to visualize that it's clickable.
span.styleMe{
cursor:pointer;
}
The reason, besides having to deal with the href issue is that I personally always associate anchor elements with navigating away from the current page and due to a slow internet connection I never use them directly always open in another tab.
I always want to let it load in a new tab while I continue browsing the current page, because a new page takes several minutes to load on average.
That's why I suggest to make a clear distinction between "a click that will make you wait minutes and loose the page you waited several minutes to load unless you choose an alternative open-in-new-tab-option" and "a click that will instantly change the content of the current page or instantly scroll to a place somewhere on the same page"