[jQuery] Re: How to call mouseover of the element in loop

2009-11-05 Thread vmrao
OK. This is what I am trying to do. $('ul.News li').each(function() { curTimeInterval += timeInterval; //alert(this.id); works here setTimeout(function() { UpdateNews(this.id); //How to get this.id to work here ?

Re: [jQuery] Re: How to call mouseover of the element in loop

2009-11-05 Thread Michael Geary
Avoid 'this'. In the setTimeout() callback, 'this' is the window object! Instead you can do: $('ul.News li').each(function( i, element ) { curTimeInterval += timeInterval; //alert(element.id); works here setTimeout(function() {