Good people,
I needed to change the return value when I clicked the button, that is, first click
would have to return false
and passed x segundos
would have to return true
and proceed with the event.
The code is as follows:
$(".btnnext").on("click",function (e) {
if (newText != "" || newText2 != "" || newText3 != "" || newText4 != "") {
var teste = false;
setTimeout((function () {
teste = true;
console.log(teste);
$(".btnnext").trigger("click");
return teste;
}), 2000);
return teste;
}});
My approach was to first return false and later with the function setTimeout
change the return value and simulate the click again on the button.
Issue: The return value changes but the event does not progress, the second click does not work.
What I want is that when you click the button, for example, when you move from step 2 to step 3, take a x seconds