// $(document).ready(function() { $('th').parent().addClass('table-heading'); $('tr:not([th]):even').addClass('even'); $('tr:not([th]):odd').addClass('odd'); $('td:contains("Henry")').addClass('highlight'); }); //
It is supposed to add 'even' and 'odd' classes to odd and even number of rows of a table EXCEPT TABLE HEADER, but unfortunaley it is not working as it should because it also formates the heading (attaching 'even' class to table header and I can see it in firebug). It looks that the filter '[th]' is not working. Tested both on FF and IE, same problem on both. Is it something wrong with [th]? Any recommendation? One more thing, I also tried it with 'jquery-1.2.2.js', but the same problem. Thanks in advance..