title: Prev next button hide in pagination?
body: <p>I'm using a custom JavaScript pagination in our project but now I need to know how to hide the <strong>next</strong> or <strong>prev</strong> button using JavaScript or jQuery. </p>
  
  <ol>
  <li>If I click to last number then hide the next button else show it.</li>
  <li>If I click to 1 number then hide the perv button else show it.</li>
  </ol>
  
  <p>My code is given below:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$(document).ready(function(){
        
      $("#pageNavPosition &gt; span").on("click", function(){
         var thisBtn = $(this);
          $("#pageNavPosition &gt; span").removeClass('active');
          thisBtn.addClass('active');
           var btnLg = $("#pageNavPosition &gt; span").length;
      });
      
  });</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>#pageNavPosition &gt;span{
      
      border:solid 1px red;
      padding:3px 5px;
      float:left;
      margin:2px;
      cursor:pointer;
  }
  .active{
      
      background:#ccc;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"&gt;&lt;/script&gt;
  &lt;div id="pageNavPosition" style="display: block;"&gt;
      &lt;span&gt;  Prev &lt;/span&gt;  
      &lt;span&gt;1&lt;/span&gt;  
      &lt;span&gt;2&lt;/span&gt;
      &lt;span &gt;3&lt;/span&gt;  
      &lt;span&gt; Next &lt;/span&gt;&lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>