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

194
Views
redirect location.replace does not work in button click event listener Javascript

it's been an entire day I'm looking for a solution, so please answer if you know why the redirect dose not work?! I test all the methods of object location also I tried window.location methods but all are useless for me!

<script>
    document.getElementById("doneButton").addEventListener("click", myfunction);
    function myfunction(){location.replace('/index.php');}
</script>
<form id="myForm" role="form" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);? "method="post" enctype="multipart/form-data">
<div class="formDiv">
<div id="printableArea">
<p> hello </p>
</div>
<input type="submit" id="printButton" onclick="printDiv('printableArea')" value="Print" >
<input type="submit" id="doneButton" value="Done" >
</div>
</form>

about 4 years ago · Juan Pablo Isaza
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!