where do i pass the index parameter ?
hey guys i have the following HTML :
- <nav class="product-nav">
- <ul class="nav-list-holder">
- <li><a href="#overview" class="active">History</a></li>
- <li><a href="#quality">Quality</a></li>
- <li><a href="#offerings">Offerings</a></li>
- </ul>
- </nav>
and the following Jquery code :
- $jobslist = $('.nav-list-holder a');
-
- $($jobslist).on('click', function(e ){
- // var $(me) = $(this);
- e.preventDefault();
- var newcontent = $(this).attr('href');
-
- if(!$(this).hasClass('active')) {
- $('.nav-list-holder a.active').removeClass('active');
- }
- $(this).addClass('active');
-
- if(!$(newcontent).hasClass('displayed')) {
- $('.tab.displayed').removeClass('displayed');
- $(newcontent).addClass('displayed');
- }
-
- var loc = $('.nav-list-holder a').eq(index);
- console.log(loc);
-
- });
my last line of code I.E.
- console.log(loc);
throws an error , ReferenceError: index is not defined .
obviously , i am passing index anywhere as a parameter , where do i need to pass the index parameter , so that in the console.log(index); i can print out the correct index ??