Reputation: 109
In wikipedia's table of contents, by simply putting a hash tag and removing the whitespaces using underscores on the desired content, we can jump to different contents in the same page. Is there a HTML tag to do this? Or must I use Javascript? If so, give me the syntax in jQuery since I'm more comfortable with it. Thanks!
Upvotes: 1
Views: 8925
Reputation: 943569
Fragment identifiers on URIs link to elements with matching ids.
<a href="#foo">section name</a>
...
<div id="foo">section contents</div>
Upvotes: 5
Reputation: 2286
Normally you would link to named anchors, like so:
<a name="top"></a>
<a href="#top">go to top of page</a>
But you can use any matching ID really.
Upvotes: 1