I have a link at the top of my page in MODX 2.1.5
<p><a href="[[~[[*id]]]]#registration">Register product</a></p>
And way down the page I have the anchor
<a name="registration"></a>
But it won't work. Even if I place a link on another page specifying to go to the anchor, it doesn't work. Any ideas would be great. Thanks.
-
☆ A M B ☆
- 24,524 Posts
You don't need to use <a name="registration"></a>; any element with the same ID will also work <div id="registration"></div>.
If you have a name attribute and also another element with an ID attribute with the same value - a form, for example, with id="registration" - then it won't work.
-
☆ A M B ☆
- 24,524 Posts
Must be; I tried it on a page with and it worked just fine. I seem to vaguely remember something about certain browsers and a very long page not working, but I'm not finding anything about that now.
Can you give a URL to look at the real thing?
-
☆ A M B ☆
- 24,524 Posts
I did find something about IE not working correctly (big surprise) if the anchor had no text, it needed at least a non-breaking space.
It doesn't work in any browser. I only have a local copy I'm working on. I'm wondering if there is a setting preventing it from working? Thanks for your help though. I never thought something as simple as an anchor would cost me so much time.
copy and paste the source here or pastebin so we can look
-
☆ A M B ☆
- 24,524 Posts
Very strange. I pasted the two lines you posted, put a bunch of nonsense between, and it worked fine. There must be something on the page keeping it from working properly. That's why I wanted to see the whole page.
Have you pasted the entire page's HTML into the w3c validator?
Thank you everyone! You were all instrumental in leading me in the right direction. I'll try to explain. I had my page creating two small sections for two different purposes. Then I'd hide the section that wasn't currently in use using CSS and show the other section, and vice versa. So, in essence they were both using similar chunks and TVs. And. Voila, one of them was an ID and hence had the same name. Yet again it was my mistake and not a MODX issue. And I've learned a lesson.
THANKS!!
-
☆ A M B ☆
- 24,524 Posts
That's what we're here for
Would you please mark this "answered"?