title: jQuery "select all except"
body: <p>I am trying to select the first row of a table. Note: the first row is wrapped in a <code>thead</code> tag, so:</p>
  
  <pre><code>&lt;table&gt;
    &lt;thead&gt;
      &lt;tr&gt;  &lt;!-- first row --&gt; &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
      &lt;tr&gt;  &lt;!-- body --&gt; &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;tfoot&gt;
      &lt;tr&gt;  &lt;!-- body --&gt; &lt;/tr&gt;
    &lt;/tfoot&gt;
  &lt;/table&gt; 
  </code></pre>
  
  <p>The <a href="https://stackoverflow.com/questions/1045926/jquery-selector-for-every-row-except-the-first-on-every-table-except-first">'select first row'</a> tip could work if it wasn't for the  wrapper tags. This is what I have tried but doesn't work:</p>
  
  <pre><code> $("*:not(thead)", tableSelector).remove();
  </code></pre>
  
  <p>I.e., I would like to get rid off both tbody and tfoot selectors using a "not tfoot" selector. Because I want to remove everything else from the table except the <code>&lt;thead&gt;</code> and everything-inside-thead. So basically what I am trying to do is to select everything except thead and what's inside it; intutuively something like <code>:not(thead *)</code> could work, but doesn't.</p>
  
  <p>My workaround is <code>$("tbody, tfoot", tableSelector).remove();</code> but I would like to learn and understand how to use the opposite (not-selector).</p>