Select all table rows from start to one in particular
<p>I'm trying to do something with a calendar which is enclosed in a table. Basically, every day is a table cell. The today cell has a special class called... <code>.today</code> (quite original).</p>

<p>I want that, when the user clicks a day-cell it happens something. For the sake of usability I want to add a class to those days so the mouse cursor changes to a link-style.</p>

<p>I've been trying to do my best but, so far no luck.</p>

<p>So, for example, here are the first three weeks of May with today with the class named:</p>

<pre><code>&lt;table class="calendar"&gt;
    &lt;tbody&gt;
        &lt;tr class="week0"&gt;
            &lt;td class="day"&gt;30&lt;/td&gt;
            &lt;td class="day"&gt;1&lt;/td&gt;
            &lt;td class="day"&gt;2&lt;/td&gt;
            &lt;td class="day"&gt;3&lt;/td&gt;
            &lt;td class="day"&gt;4&lt;/td&gt;
            &lt;td class="day"&gt;5&lt;/td&gt;
            &lt;td class="day"&gt;6&lt;/td&gt;                                                                  
        &lt;/tr&gt;
        &lt;tr class="week1"&gt;
            &lt;td class="day"&gt;7&lt;/td&gt;
            &lt;td class="day"&gt;8&lt;/td&gt;
            &lt;td class="day"&gt;9&lt;/td&gt;
            &lt;td class="day"&gt;10&lt;/td&gt;
            &lt;td class="day"&gt;11&lt;/td&gt;
            &lt;td class="day"&gt;12&lt;/td&gt;
            &lt;td class="day"&gt;13&lt;/td&gt;                                                                 
        &lt;/tr&gt;
        &lt;tr class="week2"&gt;
            &lt;td class="day"&gt;14&lt;/td&gt;
            &lt;td class="day"&gt;15&lt;/td&gt;
            &lt;td class="day"&gt;16&lt;/td&gt;
            &lt;td class="day"&gt;17&lt;/td&gt;
            &lt;td class="day"&gt;18&lt;/td&gt;
            &lt;td class="day today"&gt;19&lt;/td&gt;
            &lt;td class="day"&gt;20&lt;/td&gt;                                                                 
        &lt;/tr&gt;               
    &lt;/tbody&gt;
&lt;/table&gt;
</code></pre>

<p>I want to select the tds from 30 (day) to 19.</p>

<p>Approaches taken:</p>

<ul>
<li>Select all days and then try to find the index of the today-cell. Fails, because a jQuery selection is not an array but an object.</li>
<li>Use <code>$.each</code> and use a flag once <code>today</code> is reached. This works, but sounds really bad for performance [?]</li>
</ul>

<p>Is there a way I'm missing?</p>
