title: jQuery: how to select the last N columns of each row in a table?
body: <p>I have a table with 6 columns. I want to run a function on the last 3 columns of each row (excluding the header row). I have the following selector that is working:</p>
  
  <pre><code>$('table.listviewtable &gt; tbody &gt; tr:gt(0)').find('td:gt(2)')
      .each(function () { runMyFunction($(this)); });
  </code></pre>
  
  <p>Is there a way to do this all in one selector (ie, without the intermediate <code>find</code>)?</p>
  
  <p><strong>Update:</strong></p>
  
  <p>I've tried</p>
  
  <pre><code>$('table.listviewtable &gt; tbody &gt; tr:gt(0) td:gt(2)')
  </code></pre>
  
  <p>and</p>
  
  <pre><code>$('table.listviewtable &gt; tbody &gt; tr:gt(0) &gt; td:gt(2)')
  </code></pre>
  
  <p>but they did not work. They returned the 4th, 5th, and 6th columns of the 2nd row and all columns of all subsequent rows.</p>