Linking to a section on another page

I am working on a site and I am trying to build a navigation that links to a section on another page, however it’s not working and I’m not sure why or if there’s some other backend process that is blocking it.

On page 1, I have a section farther down on the page which I called <p id=”trainingsect”></p>

On Page 2, I have a link like this: <a href=”linktopage1.com#trainingsect”>Link to Training Section on Page 1</a>

However, when clicking the link on Page 2, it takes me back to page 1, but does not take me to the paragraph with <p id=”trainingsect”>

The trainingsect id works when I’m on the same page, but it’s not working when I try to link it from another page.

Does anyone have a solution or work around for this?

 

we also tried using this js but no luck

function getParameterByName(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\

var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, ' '));
}

var className = getParameterByName('className');
var element = document.getElementsByClassName(className);

element.scrollIntoView();]]>
Parents
  •   They are both home pages linking from one home page, to another home page

Reply
Children
No Data