GetSimple Support Forum

Full Version: Anchor Tags Not Working
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I could use some help figuring out why my anchor tags are not working. I want to link to a specific line of text on another page on the site using the following markup:

<div class="team"><a href="staff#jacquie">Jacquie Wyant</a></div>

<a name="jacquie">Jacquie Wyant</a>

Any help would be greatly appreciated!

See attachments for details.
use ids not names
<div class="team"><a href="/staff#jacquie">Jacquie Wyant</a></div>
No
<a id="jacquie">Jacquie Wyant</a>
<h1 id="jacquie">Jacquie Wyant</a>
That should be fine, according to browser tests I did a while ago: 

Quote:Apparently Mozilla Firefox doesn't associate the id attribute with a location in the HTML Document for elements other than <a> but uses the name attribute instead, and Google Chrome does exactly the opposite. The most cross-browser proof solution would be to either:
1.Give your anchor divs both a name and an id to ensure max. browser compatibility, like:
<a href="#map">Go to Map</a> <!-- Link -->
----
<div id="map" name="map"></div> <!-- actual anchor -->
Demo: http://jsbin.com/feqeh/3/edit
2.Only use <a> tags with the name attribute as anchors.

In this case, if Jacquie is a location on the same page the href attribute should be #jacquie and if it's on another page called staff it should be staff#jacquie, and should work regardless whether you're using a named anchor or id'd element.

If you're using ID's and want to be absolutely sure it works you can always put this type of script at the bottom of the linked page:
Code:
<script>
  var loc = location.href;
  if (loc.match('#')) && document.getElementById(loc.split('#')[1]))
     document.getElementById(loc.split('#')[1]).scrollIntoView();
</script>
on my site all the anchor work and name and id
http://gs-blog.business-website.ru/yakorya/
maybe he uses the plugin Custom menu
Thanks for all the input from everyone, however I tried both id and name and neither works. It goes to the proper page but doesn't find the tagged div. Any ideas?
what browser? works for me
I've viewed it in Safari, Chrome and Firefox so far. Like I said, the link goes to the staff page but it doesn't take you to the tagged div on the page. Go to www.challengeyourbody.com and on the "About Us" page, click on Kevin Needler's name. It should go to his bio on the page, but doesn't.

Thanks for looking.
your link anchor has quotes around it
(2015-05-29, 04:55:27)shawn_a Wrote: [ -> ]your link anchor has quotes around it

Lol yeah the referring link is http://www.challengeyourbody.com/about-us/"staff#kevin”.
Should be http://www.challengeyourbody.com/staff#kevin
Code:
<a href=“staff#kevin”>Kevin Needler</a>
replace it
Code:
<a href="staff#kevin">Kevin Needler</a>
Well, thanks everyone. It's the small things that trip me up! LOL!