Primary Nav working only in homepage.

I created a primary nav on my homepage, to be used on several other pages I aimed to create. The nav links and submenus are working fine until I created a new page. The links stopped working on the page but still works perfectly fine on the homepage. This is weird. I believe I linked my new page well to the JS file, and it should be working, but it is not. Please what could be the possible cause of this?
5 Replies
Jochem
Jochem16mo ago
without seeing the code, there's pretty much no way to tell. Do you have the site hosted somewhere so people can take a look?
Adedoyin Adeyemo Muhammed
It isn’t hosted yet, I want to complete it before hosting. How about I push to my repo and give you the link?
Jochem
Jochem16mo ago
I'm not really in a position to take a look myself, but no one is going to be able to answer this one without seeing the code, and preferably seeing it in a way that they can actually see the problem in action
Adedoyin Adeyemo Muhammed
Okay, I will find a way to get the codes here
swcoll2021
swcoll202116mo ago
Without seeing the code it's difficult to identify the cause, however, this is often the case where you have pages in folders and the links are relative, so href="about/index.html", when you jump to a a particular folder nothing is found because the server is looking within the folder for the link, try a root relative URL, like href="/about/index.html", that's generally means from the root of the project go to this directory and look for this file. Other than that use the full URL href="http://localhost/about/indexlhtml" as an example, if your server is on localhost port 80. Hope that helps.
Want results from more Discord servers?
Add your server