1

I want to direct a visitor to a specific div in another html file, This is how it goes in the same html: <a href="#goTo"></a> but it doesnt work if the div is in another html. for example <a href="../index.html #goTo">This link should go to the div goTo in the index file </a>

Azertit
  • 102
  • 9

3 Answers3

0

Remove the space in your link:

<a href="../index.html#goTo">This link should go to the div goTo in the index file</a>
0

Try writing the anchor directly after the file name, without a space:

<a href="../index.html#goTo">This link should go to the div goTo in the index file </a>

If that doesn't work, check if the anchor really is named "goTo".

Philex
  • 37
  • 5
0

The thing you are using is called anchor.

Example:

<a href="#goTo">Go there</a>
[more html]
<h2 id="goTo">My GoTo Header</h2>

You can also adress anchors on other sites with e.g.:

<a href="otherSite.html#goTo">Go there</a>
Community
  • 1
  • 1
DaniEll
  • 1,022
  • 4
  • 22
  • 31