Having problem with JQuery .index
<p>I need help regarding of .index(had try several way to achieve what I want but unfortunately its failed and got an headache lol , perhaps someone here can point me to a right direction-I do appreciated it)</p>

<p>I have this kind of list(that act as a tabs):</p>

<pre><code>&lt;ul class="menutabs slideshow"&gt;
&lt;li&gt;&lt;a href="" class="current-page-item"&gt;Latest Addition&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=""&gt;Most Download&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=""&gt;Most Watch&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=""&gt;Top Rated&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;!-- some other html here --&gt;
&lt;ul class="menutabs"&gt;
            &lt;li&gt;&lt;a href="" class="current-page-item"&gt;Genres&lt;/a&gt;&lt;/li&gt;
            &lt;li&gt;&lt;a href=""&gt;Years&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;!-- some other html here --&gt;
&lt;ul class="menutabs"&gt;
            &lt;li&gt;&lt;a href="" class="current-page-item"&gt;Top Rated&lt;/a&gt;&lt;/li&gt;
            &lt;li&gt;&lt;a href=""&gt;Popular&lt;/a&gt;&lt;/li&gt;
 &lt;/ul&gt;
</code></pre>

<p>This is the js code:</p>

<pre><code>// on click show the associated tab list
$('.menutabs li').click(function(i) {
i.preventDefault();
//var index=$('.menutabs li').index(this);
var index=$('.menutabs li').eq();
var parent=$('.menutabs li:eq('+index+')').parent().index();
alert('INDEX MENUTABS LI A:'+index+' INDEX PARENT:'+parent);
$('.menutabs li:eq('+index+') a').removeClass('current-page-item');
$('.menutabs li:eq('+index+') a').toggleClass('current-page-item');
}
</code></pre>

<p>The alert part have shown the correct Index number for the anchor link. However for the parent index, it seem only the 1st and 2nd of .menutabs that giving a correct index number but not for the last one(the 3rd menutabs).</p>

<p>However, when trying to change the css border, it work perfectly(the .menutabs border have been changed to the red color as specified). That really make me confused.</p>

<p>Actually the alert and css border part only as a testing where I try to catch the error, what I need is to detect the index number of the parent .menutabs when user clicked on the anchor link inside that class. So then I can change the class name for other li inside that .menutabs.</p>

<p>Do anyone have any suggestion for resolving this problem and thank in advance</p>
