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?
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