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

264
Views
HTML link - href if javascript is disabled, onclick if js is enabled

To send users to different links, I use a JS function that when called, creates an animation, times out for a bit and then location.href the user, the problem is that if a user does not have JS enabled, he will not be redirected to the site. Is there any way onclick wold redirect the user normally if he does not have JS enabled and redirect it with my function if JS is enabled?

Thanks is advance!

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

0

You could try creating the element with both href and onclick attributes. Then, in your JS, set the href attribute to "javascript:void(0)".

Code would look something like this:

html

<a id="jsElement" href="/newPage.html" onclick="callFunction()">Text</a>

javascript

window.onload = function() {
    document.getElementById("jsElement").setAttribute("href", "javascript:void(0)");
}
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!