[jQuery] Passing jQuery object to a function
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;
});
});