I have a simple count function increments a number into an input field. This works exactly how I would like it to work. The only problem is, is that i have a long JS script with multiple function and I only want the script to continue runnning when the count() function is complete.
JSFIDDLE http://jsfiddle.net/vyN6V/243/
var number = 1500;
var aValue = 300;
function count(Item) {
var current = aValue;
Item.val(aValue += 1);
if (current < number) {
setTimeout(function () {
count(Item)
}, 0.1);
}
}
count($(".input"));
// the rest of the script should only run when the above function has completed
$('span').text('code here should only run when function count is complete');