That's an XPath selector, not a CSS selector. To do that in jQuery you would need to do:
$("tr:not(:has(th)):even") --John On Dec 20, 9:38 am, "chinnakarup...@gmail.com" <chinnakarup...@gmail.com> wrote: > Hi, > I tried a eg for :not operator.According to which it should not pick > up the Table header but it does .what am i missing. > One more question .... > what is the significance of putting the 'th' in the square bracket .is > it OK to write like this. > > $('tr:not(th):even').addClass('even'); > > THnks > > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" > "http://www.w3.org/TR/html4/loose.dtd"> > <html xmlns="http://www.w3.org/1999/xhtml"> > <head> > <meta http-equiv="Content-Type" content="text/html; > charset=utf-8" /> > <title>New Web Project</title> > <style type='text/css'> > > .even{ > background-color:blue; > } > > </style> > <script type="text/javascript" src="/lib/jquery/ > jquery.js"></script> > <script type="text/javascript"> > $(document).ready(function(){ > > $('tr:not([th]):even').addClass('even'); > > }) > </script> > </head> > <body> > > <table> > <tr> <th>Title</th> <th>Category</th> </tr> > <tr> <td>As You Like It</td> <td>Comedy</td></tr> > <tr> <td>All's Well that Ends Well</td> <td>Comedy</td></tr> > <tr> <td>Hamlet</td> <td>Tragedy</td></tr> > <tr> <td>Macbeth</td> <td>Tragedy</td></tr> > <tr> <td>Romeo and Juliet</td> <td>Tragedy</td></tr> > <tr> <td>Henry IV, Part I</td> <td>History</td></tr> > <tr> <td>Henry V</td> <td>History</td></tr> > </table> > </body> > </html>