Using jQuery, want to count the number of elements with specific class occuring after a class
<p>I want to be able to get the count of number of right columns occurring after a left column using jQuery.</p>

<p>For eg: in the below structure, the results should be </p>

<p>1st leftColumn = 3;
2nd leftColumn = 1 and so on...</p>

<pre><code>&lt;div class="panel leftColumn"&gt;&lt;/div&gt;
&lt;div class="panel rightColumn"&gt;&lt;/div&gt;
&lt;div class="panel rightColumn"&gt;&lt;/div&gt;
&lt;div class="panel rightColumn"&gt;&lt;/div&gt;
&lt;div class="panel leftColumn"&gt;&lt;/div&gt;
&lt;div class="panel rightColumn"&gt;&lt;/div&gt;
</code></pre>

<p>Note: My jQuery figures out which column the divs fall into and adds the class name as appropriate, so it would be great if a solution could be fit into my code below</p>

<pre><code>var dataHolder = $j("div.panel").first().offset().left;

if($j(this).offset().left == dataHolder){
                $j(this).addClass("leftColumn");
            }
            else{
                $j(this).addClass("rightColumn");
            }
</code></pre>
