I am trying to make jQuery update the values in the selector after they are passed. What I mean is this.
I am passing the selector like this.
var items = ['.item-1','.item-2'...];
$(items[1]).click(function(){....});
And then in the end of the function I change the order of the items array.
var items = ['.item-1','.item-2'...];
$(items[1]).click(function(){
// ... function
items = ['.item-3', '.item-1' ...];
});
Now the problem is that the function is binded to the inital items[1], so my changing of the array does not really matter. I am pretty sure there should be a not too complicated solution, so can you please point me in the right direction ?