Selecting the last child elements of a div without looping
<p>Here's a quick one. I'm trying to get better at writing selectors for jquery because I seem to be relying on loops far too much in order to get things done.</p>

<p>In this particular example, I want to add the "Absolute" class too all of the divs that have the ganttview-block-container class except the last one in the parent ganntview-blocks div.</p>

<p>HTML:</p>

<pre><code>&lt;div class='ganttview-blocks'&gt;    
 &lt;div class='ganttview-block-container'&gt;&lt;/div&gt;
 &lt;div class='ganttview-block-container'&gt;&lt;/div&gt;
 &lt;div class='ganttview-block-container'&gt;&lt;/div&gt;    
&lt;/div&gt;

&lt;div class='ganttview-blocks'&gt;    
 &lt;div class='ganttview-block-container'&gt;&lt;/div&gt;
 &lt;div class='ganttview-block-container'&gt;&lt;/div&gt;
 &lt;div class='ganttview-block-container'&gt;&lt;/div&gt; 
&lt;/div&gt;
</code></pre>

<p>Javascript:</p>

<pre><code>$("div.ganttview-block-container").addClass("Absolute").addClass("Opacity");

$($("div.ganttview-blocks")).each(function () {
  var thisDiv = $(this);
  thisDiv.children("div.ganttview-block-container:last").removeClass("Absolute");    
});
</code></pre>

<p>My javascript/jquery accomplishes this goal correctly but it seems so inefficient. I'm confident there's a more elegant way of getting this done... perhaps even in 1 line.</p>

<p>Can anyone help? Thanks!</p>
