Get next element with the same class
<p>I use a click event for an element with certain class. Inside the click event function I need to get the next element on page with the same class. I tried:</p>

<pre><code>$('.class').click(function() {
    var $next = $(this).next('.class')  
});
</code></pre>

<p>And:</p>

<pre><code>$('.class').click(function() {
    var $next = $(this).parent().parent().parent().next('.class')  
});
</code></pre>

<p>The .class is a div inside td in a table, that's why three times parent().</p>

<p>My HTML is something like this (The .class is .drag):</p>

<pre><code>&lt;table cellspacing="0" cellpadding="0" border="0" class="black8"&gt;
&lt;tr class="trow1 drop trow1_over" 
    rel="0,1"&gt;
    &lt;td&gt;
            &lt;div class="drop rootFolder" 
                 rel="0,1"&gt;&lt;/div&gt;
    &lt;/td&gt;
    &lt;td width="100%" 
        class="folderListOnclick"&gt;

            &lt;span&gt;.. (koreňový adresár)&lt;/span&gt;
    &lt;/td&gt;
    &lt;td&gt;
    &lt;/td&gt;
    &lt;td&gt;
    &lt;/td&gt;
&lt;/tr&gt;&lt;tr class="trow1"&gt;
    &lt;td&gt;
        &lt;div class="drag drop ordinaryFolder" 
             rel="1,1" 
             style="width: 40px;"&gt;

        &lt;/div&gt;
    &lt;/td&gt;
    &lt;td width="100%" 
        class="folderListOnclick" 
        rel="1"&gt;
            &lt;span&gt;aaa&lt;/span&gt;
    &lt;/td&gt;
    &lt;td&gt;
        &lt;div class="button_mini folderEditOnclick" 
             rel="1"&gt;
                    &lt;span&gt;&lt;/span&gt;

        &lt;/div&gt;
    &lt;/td&gt;
    &lt;td&gt;
        &lt;div class="button_mini folderDeleteOnclick" 
             rel="1"&gt;
                    &lt;span&gt;&lt;span&gt;
        &lt;/div&gt;
    &lt;/td&gt;
&lt;/tr&gt;&lt;tr class="trow1"&gt;
    &lt;td&gt;

        &lt;div class="drag drop ordinaryFolder" 
             rel="19,1" 
             style="width: 50px;"&gt;
        &lt;/div&gt;
    &lt;/td&gt;
    &lt;td width="100%" 
        class="folderListOnclick" 
        rel="19"&gt;
            &lt;span&gt;subaaa&lt;/span&gt;
    &lt;/td&gt;
    &lt;td&gt;
        &lt;div class="button_mini folderEditOnclick" 
             rel="19"&gt;

                    &lt;span&gt;&lt;/span&gt;
        &lt;/div&gt;
    &lt;/td&gt;
    &lt;td&gt;
        &lt;div class="button_mini folderDeleteOnclick" 
             rel="19"&gt;
                    &lt;span&gt;&lt;span&gt;
        &lt;/div&gt;
    &lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
</code></pre>
