The issue I am having is:
How do I go from a variable pointing at a dom element to using CSS selectors?
I want to make this work:
function highlight(table)
{$(table " > :even").toggleClass('highlight');}
where table is a reference to a table element.
I don’t want answers that tell me to use $(‘#table’) because that defeats the point of the generality I am trying to make.
Thanks
You can do it like this:
Alternatively you can use
'> :even', but be careful because there are<tbody>elements and such to deal with here, unless you have nested tables, the code above is a more resilient approach.