Sorry for taking the time to read the aricle. It took me some time to get to reply. Your code seems fine to me. If matchText is some global variable it should work. Each call by setInternal will use a new matchText. So I am not sure what is your exact problem. Check if you ever enter the setInterval function to see if there is some race condition.