title: automatically add row after n Elements (Jquery)
body: <p>I have something like this generated by a procedure:</p>
  
  <pre><code>&lt;div class="w-row"&gt;
      &lt;div class="w-col w-col-4 entry abc"&gt; ... &lt;/div&gt;
      &lt;div class="w-col w-col-4 entry abc def"&gt; ... &lt;/div&gt;
      &lt;div class="w-col w-col-4 entry def"&gt; ... &lt;/div&gt;
      &lt;div class="w-col w-col-4 entry 123"&gt; ... &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>To keep it correct however, I would like to wrap every 3 columns with a div with the class "w-row".</p>
  
  <p>My output should be something like:</p>
  
  <pre><code>&lt;div class="w-row"&gt;
      &lt;div class="w-col w-col-4 entry abc"&gt; ... &lt;/div&gt;
      &lt;div class="w-col w-col-4 entry abc def"&gt; ... &lt;/div&gt;
      &lt;div class="w-col w-col-4 entry def"&gt; ... &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="w-row"&gt;
      &lt;div class="w-col w-col-4 entry 123"&gt; ... &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>So, this is a galery plugin, so the number of elements may change after clicking on a filter. To display it, i have small function, as you can see here:</p>
  
  <pre><code>// show only divs, which has the current filter in its classes
      $('.entry').each(function() {
          if (!$(this).hasClass(filtername)) {
              $(this).fadeOut();
          } else {
              $(this).fadeIn();
          }
      });
  </code></pre>
  
  <p>I tried to add a counter-variable <code>cnt</code> and "wrap" every 3 items with a div, but that didn't work. Also i tried to add HTML (just a simple ) but for some reason i was overriding everything (guess because i used $.html();</p>
  
  <p>Thanks for any advices</p>