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

69
Views
Issue Replacing URL using JS

I've been trying to swap out a link on a page using javascript and seem to have hit a wall. I believe the way my URL is encoded might be at fault.

var a = document.querySelector('a[href="https://sis.harpercollege.edu/class-schedule/class-schedule.html?course=230&subject=BIO&term=202295&_gl=1*1wa2tu7*_ga*MTA4NzY5ODQ3LjE2MjQ4ODM4NjY.*_ga_2575BXQHNN*MTY0OTY5MTI0NC4yNDYuMS4xNjQ5Njk1NDY0LjA"]');
if (a) {
  a.setAttribute('href', 'https://sis.harpercollege.edu/class-schedule/class-schedule.html?course=130&subject=BIO&term=202295&_gl=1*1wa2tu7*_ga*MTA4NzY5ODQ3LjE2MjQ4ODM4NjY.*_ga_2575BXQHNN*MTY0OTY5MTI0NC4yNDYuMS4xNjQ5Njk1NDY0LjA')
}
<a title="View the schedule for BIO230 for Summer 2022" href="https://sis.harpercollege.edu/class-schedule/class-schedule.html?course=230&amp;subject=BIO&amp;term=202295&amp;_gl=1*3cwusx*_ga*MTA4NzY5ODQ3LjE2MjQ4ODM4NjY.*_ga_2575BXQHNN*MTY0OTY5MTI0NC4yNDYuMS4xNjQ5Njk2MTkzLjA" target="_blank">Summer 2022</a>

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You're trying to select this a[href="https:///sis.harpercollege.edu/class-schedule/class-schedule.html?course=230..... but in your html you have this <a title="View the schedule for BIO260 for Summer 2022" href="https:///sis.harpercollege.edu/class-schedule/class-schedule.html?course=260

Basically The code in your condition will never get executed because query selector doesn't find an a tag with that href attribute value.

about 4 years ago · Santiago Trujillo 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!