jQuery :not Filters

The :not() filter can be used to find elements that do not match a particular selector type. For example, say you want to select row of a table except the first row, you can do it using


You can use :not() with any of the jQuery filters and with most jQuery selectors. As another example, to find every link that does not begin with http://referencedesigner.com, you can write this:


Aa a practical example you may like to highlight the first row of a Table with a pink background color and other rows using a different background color. We use not selector to select all rows other than the first row

<script type="text/javascript" src="jquery-1.8.0.min.js"></script>
  $("tr:first").css("background-color", "pink");
  $("tr:not(:first)").css("background-color", "gainsboro");


<h1>List of Cars </h1>

<table border=1>
      <td>Honda </td>
      <td>Ford </td>


You may like to try this example here.