1

I am looking for a way to link to an anchor on another page. I did some research already and added the ids in question, but it is still not working.

Here is a snippet of the code with the links:

<div class="col-md-15 col-sm-3">
    <h5 class="text-info">SALES</h5>
    <a href="sales-training-tabs.html" id="#sc">Read More &raquo;</a>
</div>

I would like the "Read More" links to direct users to the specified sections on the page being linked. I have several sections on the other page that look like this:

<div class="col-xs-12 col-sm-7 col-lg-12">
    <h2 id="#sc">Sales Curriculum</h2>             
</div>

How can I link to that particular h2 from the previous page?

Purag
  • 16,941
  • 4
  • 54
  • 75
Lynn
  • 11
  • 1
  • 2
  • What do you mean by *New way to create an achor* – Mr. Alien Aug 26 '15 at 03:23
  • 1
    What exactly are you trying to accomplish? Clicking on the "Read More" works for me. – Saad Aug 26 '15 at 03:27
  • Please include code in the question it self, or better still an SO snippet, the <> button in the editor. Please see: http://stackoverflow.com/help/mcve. Basically don't give us a whole page/site to debug, just enough code to create the problem. – Jon P Aug 26 '15 at 03:44
  • Waiting for the suggested edit to get rejected; I'll add in some minimal code from the site in question and clarify the question since I understood what is meant. They want to link to an anchor on another page. – Purag Aug 26 '15 at 03:46

3 Answers3

1

You need to add the hash to the "Read More" links.

That is, if you want to direct the user to the section with id sc on the new page, the href attribute should read:

sales_training_tabs.html#sc

And similarly for other ids.

Also, make sure the id attribute doesn't contain the #. That's strictly for the URL hash. You need <div id="sc">, or in your case, <h2 id="sc">.

Purag
  • 16,941
  • 4
  • 54
  • 75
0

The links at the footer go nowhere <href='#'> Do this:

<a href="index.html">Home</a>
<a href="about.html">About<br>Schneider</a>
<a href="sales-consulting.html">Sales<br>Consulting</a>
<a href="sales-training.html">Sales<br>Training</a>
<a href="hiring-assessment.html">Hiring<br>Assessments</a>
<a href="mobile_learning.html">Mobile<br>Learning</a>
<a href="performance.html">Proof of<br>Performance</a>

The "Learn More" links open to a lightbox I assume that's how it should work?

zer00ne
  • 41,936
  • 6
  • 41
  • 68
0

Well consider me told, this answer isn't valid for HTML5!


Original answer:

Purag is partially correct, you must add the hash followed by the identifier of the section in your destination URL:

<a href="sales-training-tabs.html#sc">Read More &raquo;</a>

But this does not go directly to the element with the id set to "sc". For this, you need to set the target section using the name attribute of the a tag:

<a name="sc"><h2>Sales Curriculum</h2></a>
Eraph
  • 1,019
  • 1
  • 10
  • 21
  • So it does! Apparently I'm still stuck in 1998 mode... There is a good explanation here, including a point that `name` is no longer a valid attribute for an a tag as of HTML5: http://stackoverflow.com/a/484781/2559906 – Eraph Aug 26 '15 at 11:10
  • Really interesting, actually. I may be an oblivious youngster or something, but I had no idea you used to use `name` for such a thing! :P – Purag Aug 26 '15 at 11:14