title: Using Jquery to wrap dynamic content with html tags
body: <p>I have a page that returns a dynamic list of items</p>
  
  <pre><code>&lt;ul&gt;
  &lt;li&gt;item1&lt;/li&gt;
  &lt;li&gt;item2&lt;/li&gt;
  &lt;li&gt;item3&lt;/li&gt;
  &lt;li&gt;item4&lt;/li&gt;
  &lt;li&gt;item5&lt;/li&gt;
  &lt;li&gt;item6&lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>I need a way to insert  tags around every grouping of 3 list elements. Basically transform the code above into this</p>
  
  <pre><code>&lt;ul&gt;
   &lt;div&gt;
    &lt;li&gt;item1&lt;/li&gt;
    &lt;li&gt;item2&lt;/li&gt;
    &lt;li&gt;item3&lt;/li&gt;
   &lt;/div&gt;
   &lt;div&gt; 
    &lt;li&gt;item4&lt;/li&gt;
    &lt;li&gt;item5&lt;/li&gt;
    &lt;li&gt;item6&lt;/li&gt;
   &lt;/div&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>I have been playing around with the Jquery Wrap(),WrapAll(), WrapInner()... but with no success so far. Greatly appreciate any solutions or ideas on this. </p>