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

123
Views
The function that disables a button only takes effect when a function running in parallel with it is active

I have two buttons Start and Next. I want that, initially the Start button is in the enabled state, and the Next button is in the disabled state. After the user clicks on the Start button, a function will run, and when the function is finished, the Next button will switch to the enabled state. I used the following code:

<button id="start" onclick="myfunction1" >Start</button>
<button id="next" onclick="myfunction2" disabled="disabled">Next</button>
<script>
function myfunction1(){
  google.script.run.openUrl();
  document.getElementById("start").disabled = true;
  document.getElementById("next").disabled = false;
}
</script>

When I click on the Start button, the function myfunction1() runs, and at the same time the Start button changes to the disabled state and the Next button changes to the enabled state. However, after the myfunction() function completes, the Start button returns to the enabled state and the Next button returns to the disabled state. I don't know how to solve it. I really need help. Thanks.

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!