Add new div every 3
<p>The focus is on the <code>else</code> bit, I am adding a div  <code>$('&lt;div id="content" class="span4"&gt;&lt;/div&gt;').appendTo('.new');</code>, I need to check if I already added 3 divs, and if so, add a new <code>$('&lt;div class="row-fluid new"&gt;&lt;/div&gt;').insertAfter($row);</code> and then start again</p>

<pre><code>$(".navMore li a").on("click", function() {
    var $el = $(this);
    $('#content').removeAttr('id');
    var $row = $el.closest('.row-fluid');
    if($row.next('.new').length){
        $('&lt;div id="content" class="span4"&gt;&lt;/div&gt;').appendTo('.new');
    }
    else {
         $('&lt;div class="row-fluid new"&gt;&lt;/div&gt;').insertAfter($row);
         $('&lt;div id="content" class="span4"&gt;&lt;/div&gt;').appendTo('.new');
    }
});
</code></pre>
