title: Counting divs for pagination in Jquery
body: <p>I want to create a nice pagination in Jquery for a number of divs I have. EG:</p>
  
  <pre><code>&lt;div class="container"&gt;  
      &lt;div id="one"&gt;content&lt;/div&gt;  
      &lt;div id="two"&gt;content&lt;/div&gt;  
      &lt;div id="three"&gt;content&lt;/div&gt;  
      &lt;div id="four"&gt;content&lt;/div&gt;  
  &lt;/div&gt; 
  </code></pre>
  
  <p>The number will not always be the same so I need to count the divs, and display a pagination like the one below.   </p>
  
  <p><code>1|2|3|4</code></p>
  
  <p>Clicking on the page number would display the relevant div. I know how to show and hide elements using Jquery and css and have figured out I can count the divs using </p>
  
  <p><code>var numPages = $('.container').size();</code> </p>
  
  <p>but I can't work out how I can display the pagination. </p>
  
  <p>Any pointers?</p>