So I have links that have an href value to load ajax and an onclick value to link to the top of the page. When I click the links both the ajax content loads and the url show a r
You use the attribute href
to point to another anchor (which may defined either by the name
or id
attribute.
For example:
<h3><a name="menu">Menu</a></h3>
<ul>
<li><a href="#a001">Jump to a001</a></li>
<li><a href="#a002">Jump to a002</a></li>
<li><a href="#a003">Jump to a003</a></li>
</ul>
<h3><a name="a001">a001</a></h3>
<p>paragraph text ...</p>
<h3><a name="a002">a002</a></h3>
<p>paragraph text ...</p>
<h3><a name="a003">a003</a></h3>
<p>paragraph text ...</p>
<hr>
<p><a href="#menu">Jump to Menu</a></p>
To note, you can also use id
instead of name
like so...
<a href="#a001">Jump to a001</a>
...
<h3 id="a001">a001</h3>
Read more about it here