Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

104
Views
How do i become href out of a link

Following problem: I would like to not have to copy my navigation bar over every site. So I wrote it in an extra Document and included it with php. The site ur on has a special class to show its active now that where I'm stuck at. I tried following statement just to see if my idea works

<script> if(document.getElementById("test").href == window.location.pathname){window.alert("wow");}

Spoiler alert it does not:(

I know that the pathname is the same as href(tried it) but I can't get the href like that. Does anybody know how to do that? Sorry for my English

Thanks a lot for helping

PS: I'm just getting into js I usually work with other languages but wanted to get into website design.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The problem was simple : document.getElementById("test").href gives out the whole link with www even thoug its not standing in there while window.location.pathname just gives out the path like /index.php. I had to use window.location.href instead.

Thanks for all the answers

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!