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

245
Views
How to pause js function until user presses the button?

I have an html button on my site and I want my js function to stop until user presses it. onclick="nextFunction()" doesn't help me because I need to continue in the same function. What should I do?

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

0

You can call a function after a while using the setTimeout.

const someFunction = () => {

    // do some stuff before

    setTimeout('function that you want to execute after the pause', 3000 ); // the time is in miliseconds

    // some stuff after 

}

In your case if i'm not wrong there is an listener named onmousedown, that execute something while the stuff is pressed. https://www.w3schools.com/jsref/event_onmousedown.asp

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!