Try: setTimeout(function() { playGlobalNewsFn(tabLink); return false; }, timeLag);
On Oct 8, 8:47 am, vmrao <maheshpav...@gmail.com> wrote: > I have the following code. I am getting an error in the setTimeout > function, "tabLink" is undefined. Not sure what am I doing wrong. > > function playGlobalNewsFn(obj) { > obj.click(); > > } > > $('#playGlobalNews').click(function() { > var timeLag = 1000; > $("#tabPanel2 ul li").each(function() { > var tabLink = $(this).find("a"); > setTimeout("playGlobalNewsFn(tabLink); return false;", > timeLag); // > error here > timeLag = timeLag + 3000; > }); > > }); > >