title: next previous jquery arrow highlight menu
body: <p>I am trying to add a next and previous button under my menu which higlight my items.</p>
  
  <p>When I click on each section with my mouse cursor on my menu, it works. I have each item highlighted.</p>
  
  <p>My problem is like when we click on the next or previous button it doesn't higlight item on my menu. </p>
  
  <p>What is wrong in my Jquery code ?</p>
  
  <p>Here my <a href="http://jsfiddle.net/jarod51/drQ79/1/" rel="nofollow">Fiddle</a></p>
  
  <pre><code>&lt;div id="cssmenu"&gt;
      &lt;ul id="list"&gt;
          &lt;li class='active'&gt;&lt;a id="testSlide1" href='#'&gt;&lt;span&gt;Home&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a id="testSlide2" href='#'&gt;&lt;span&gt;Products&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a id="testSlide3" href='#'&gt;&lt;span&gt;About&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a id="testSlide4" href='#'&gt;&lt;span&gt;Contact&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
      &lt;/ul&gt;
  &lt;/div&gt;
  &lt;nav class="da-arrows"&gt;
  
  &lt;button id="PrevButton"&gt;Previous&lt;/button&gt;
  &lt;button id="NextButton"&gt;Next&lt;/button&gt;
  &lt;/nav&gt;
  
  &lt;script&gt;
      $("a").click(function(){
        // If this isn't already active
        if (!$(this).parent().hasClass("active")) {
          // Remove the class from anything that is active
          $("li.active").removeClass("active");
          // And make this active
          $(this).parent().addClass("active");
        }
      });
  
      $('a').click(function(e){
          e.stopPropagation();
      });
  
      var list = $("#list");
      var li = list.children();
      var lengthMinusOne = li.length - 1;
      var index = 0;
      var num = $("#list li").length;
  
      var prevLi = $(li[0]).hasClass("active");
  
      $("#NextButton").click(function(){
         index++;
         if (index &gt; lengthMinusOne) index = 0;
         prevLi.removeClass("active");
         prevLi = $(li[index]).addClass("active");
      });
      $("#PrevButton").click(function(){
         index--;
         if (index &lt; 0) index = lengthMinusOne;
         prevLi.removeClass("active");
         prevLi = $(li[index]).addClass("active");
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>How can i do this ?</p>