tags:

views:

56

answers:

4

Hi,

Html looks like:

<div class="ticker">
        <div class="news-heading">Latest News:</div>
                    <span class="active_ticker"><a href="#"> 1] Lorem ipsum dolor sit amet, consectetur adipiscing elit.</a></span>
                    <span><a href="#">2] Mauris semper mi eget libero venenatis mattis.</a></span>
                    <span><a href="#">3] Etiam sit amet enim ante, pulvinar porta sem.</a></span>
                    <span><a href="#">4] Fusce sit amet felis at felis posuere tristique id eu nisi.</a></span>
                    <span><a href="#">5] Integer et eros augue, at cursus turpis.</a></span>
                    <span><a href="#">6] Proin id diam dolor, vitae gravida est.</a></span>

                    </div>


 var $tickeritem = jQuery(".ticker span");
 $new_ticker_item = $tickeritem.filter(":eq(" + i + ")");

What is :eq(" + i+ ") doing?

+1  A: 

jQuery Documentation:

:eq(index) Returns: Array Matches a single element by its index.

stefita
A: 

It's filtering to the appropriate index, mapped to i.

http://docs.jquery.com/Selectors/eq#index

Stefan Kendall
A: 

He is grabbing a specific span within .ticker for the index of i.

Kelsey
A: 

This will set the $new___ticker_item variable to point to the DOM element which is the first span tag within the i-th DOM element with a class of "ticker"

Ed Schembor