GetSimple Support Forum
Anchor Tags Not Working - Printable Version

+- GetSimple Support Forum (http://get-simple.info/forums)
+-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3)
+--- Forum: General Questions and Problems (http://get-simple.info/forums/forumdisplay.php?fid=16)
+--- Thread: Anchor Tags Not Working (/showthread.php?tid=7312)



Anchor Tags Not Working - pernad01 - 2015-05-28

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.


RE: Anchor Tags Not Working - shawn_a - 2015-05-28

use ids not names


RE: Anchor Tags Not Working - Oleg06 - 2015-05-28

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


RE: Anchor Tags Not Working - shawn_a - 2015-05-28

No
<a id="jacquie">Jacquie Wyant</a>
<h1 id="jacquie">Jacquie Wyant</a>


RE: Anchor Tags Not Working - Tyblitz - 2015-05-28

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>



RE: Anchor Tags Not Working - Oleg06 - 2015-05-28

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


RE: Anchor Tags Not Working - pernad01 - 2015-05-29

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?


RE: Anchor Tags Not Working - shawn_a - 2015-05-29

what browser? works for me


RE: Anchor Tags Not Working - pernad01 - 2015-05-29

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.


RE: Anchor Tags Not Working - shawn_a - 2015-05-29

your link anchor has quotes around it


RE: Anchor Tags Not Working - Tyblitz - 2015-05-29

(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


RE: Anchor Tags Not Working - Oleg06 - 2015-05-29

Code:
<a href=“staff#kevin”>Kevin Needler</a>
replace it
Code:
<a href="staff#kevin">Kevin Needler</a>



RE: Anchor Tags Not Working - pernad01 - 2015-05-29

Well, thanks everyone. It's the small things that trip me up! LOL!