I have a table and I am highlighting alternate columns in the table using jquery
$('table.Table22 tr td:nth-child(even)').css('background','blue');
However I have another <table> inside a <tr> as the last row. How can I avoid highlighting columns of tables that are inside <tr> ?
Qualify it with the
>descendant selector:You need the
tbodyqualifier too, as browsers automatically insert atbodywhether you have it in your markup or not.Edit: woops. Thanks Annan.
Edit 2: stressed tbody.