JSFiddle - React, Tailwind, and code Playground
HTML
<input class="input" value="0">
<br />
<br />
<br /> <span></span>
JavaScript
var number = 1500;
var aValue = 300;
function count(Item) {
for (var i = 1; i < 3 + 1; i++) {
var current = aValue;
Item.val(aValue += 1);
if (current < number) {
setTimeout(function () {
count(Item)
}, 0.1);
} else {
callback1();
}
}
}
count($(".input"));
function callback1() {
$('span').text('code here should only run when function count is complete');
}