If you want to avoid a setInterval and just bound the calls to the length of your list, you can create a self-executing function that saves your current index instead of using the one from the closure. The variable from the closure will end up always being the last element in your each loop, since the loop will finish long before the variable in your setTimeout function is read.
You are also calling the clearTimeout function, which doesn t make a whole lot of sense to me in this context.
On top of that, all of your setTimeouts are going to be called nearly at the same time. This would result in all the values flashing on the screen milliseconds apart (or too fast to see in some cases). A loop isn t really appropriate here, because the setTimeout function is asynchronous. A system of callbacks is best for a finite number of runs, and a setInterval system is best for an unknown amount of runs. To me your number of runs should be the number of elements in your jQuery object (the ones that are currently going through your $.each())
I would suggest that you do something like the following generalized example of your question (generalized since I don t have access to your dom).
function showMessage(message){
$( body ).html(message);
}
var itemData = [1,2,3,4];
var i = 0;
function idTimer(list, i) {
if (!(i >= 0)) {
i= 0;
}
setTimeout((function(msg){
i++;
return function(){
if(i < list.length){
idTimer(list, i);
}
showMessage(msg);
}
})(list[i]), 1000);
}
idTimer(itemData);
A live demo of this code can be found at: http://jsbin.com/ifuqo