My question is this: I have two jquery functions, and they both fill out fields in a form. Currently they run at the same time, but how can I get it run the second script only after the first is finished?
var string = 'joe@quadwtech.com',
letters = string.split(''),
total = letters.length,
index = 0,
timer = setInterval(function () {
if (index < total) {
$('input[name="email"]').val(function () {
return $(this).val() + letters[(index++)];
});
} else {
clearInterval(timer);
}
}, 100);
var stringtwo = 'Jason',
ttert = stringtwo.split(''),
totaltwo = ttert.length,
countt = 0,
timer = setInterval(function () {
if (countt < totaltwo) {
$('input[name="first"]').val(function () {
return $(this).val() + ttert[(countt++)];
});
} else {
clearInterval(timer);
}
}, 100);