title: Hide Next/Prev Link from function
body: <p>I'm working with a previous post trying to limit the number of list items using jquery and I need to hide the next/previous links when it reaches the end of the list. I'm sure this is a simple addition, but I can't seem to find a solution to augment this function. </p>
  
  <p>Here's the function: (copied from <a href="https://stackoverflow.com/questions/6635441/jquery-list-show-hide-5-items-onclick">Jquery list show / hide 5 items onclick</a>)</p>
  
  <pre><code>$('ul li:gt(4)').hide();
  
  $('.prev').click(function() {
      var first = $('ul').children('li:visible:first');
      first.prevAll(':lt(5)').show();
      first.prev().nextAll().hide()
  });
  
  $('.next').click(function() {
      var last = $('ul').children('li:visible:last');
      last.nextAll(':lt(5)').show();
      last.next().prevAll().hide();
  });
  </code></pre>
  
  <p>Here's the jsfiddle: <a href="http://jsfiddle.net/JQq5n/61/" rel="nofollow noreferrer">http://jsfiddle.net/JQq5n/61/</a></p>
  
  <p>I just need help hiding the next/prev links when it's preached the end of the list. Has anyone done this before? </p>