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 ? }, curTimeInterval); });
On Nov 5, 5:42 pm, vmrao <maheshpav...@gmail.com> wrote: > My code is as follows. How to call onMouseOver of 'li' element in the > loop from jQuery ? > > <script> > $(document).ready(function(){ > var curTimeInterval = 0; > var timeInterval = 2000 ; > $('ul.News li').each(function() { > curTimeInterval += timeInterval; > setTimeout(function() { > //I would like to invoke onMouseOver of the li element here > //I tried $(this).mouseover(); and it > did not work > }, curTimeInterval); > }); > }); > </script> > > <ul class="News"> > <li id="Story1" onMouseOver="UpdateNews('Story1')">My Stroy1</li> > <li id="Story2" onMouseOver="UpdateNews('Story2)">My Stroy2</li> > <li id="Story3" onMouseOver="UpdateNews('Story3')">My Stroy3</li> > </ul>