Reputation: 11
If I am viewing an index.html
file, how can I navigate directly to a specific <p>
of index-2.html
?
In index.html
, I've tried adding this:
<a href="#here-i-want-to-jump"></a>
And in index-2.html:
<p id="here-i-want-to-jump">Ciao sono un testo qualunque</p>
But it's clear that the id doesn't exist in index.html. How can I perform this navigation?
Upvotes: 0
Views: 275
Reputation: 15185
What you're trying to do is create an anchor in the second page and navigate to it from the first. The important thing is that the paragraph you want to "jump" to is the one that needs the ID, not the link in the first page.
So in index.html
you'd have a link like this:
<a href="index2.html#here-i-want-to-jump">Click to jump!</a>
And in index-2.html
you'd have the id set on your target:
<p id="here-i-want-to-jump">I should land here after the jump!</p>
Note that if your index-2.html
page is not very long, or if the target is close to the bottom, it might not seem like the jump worked because your browser window is too big (or your content is too small).
Upvotes: 0
Reputation: 17648
You should include the reference to index-2.html:
<a href="./index-2.html#here-i-want-to-jump">Some text</a>
Upvotes: 2
Reputation: 141
$<a href=" index-2.html#here-i-want-to-jump">Redirect to section of second Page</a>
Its Easy You can Try this
Upvotes: 1