tags:

views:

28

answers:

2

I'm using the following to stripe rows:

$(".stripeMe tr:even").addClass("alt");

I have a table with some rows. To mark the rows for the user I set one (or more rows) to have

style="background-color: red;"

Is there a way to continue to use my existing way of striping rows yet leave that one row different? I want to say "Add the class alt to all even rows except when I tell you not to"

+3  A: 

How about use a class to style the user rows instead of the inline style. Then you can do: $('.stripeMe tr:even:not(.user)').addClass('alt')

I think I've got the syntax right on that, but not 100% sure.

stevelove
I ended up with $(".stripeMe tr:even:not(.noStripeMe)").addClass("alt"); that way I can give any row the .noStripeMe class and it will be left as is.
Jason
Awesome. Glad that helped!
stevelove
A: 
$(".stripeMe tr:even").each(function(){

     $(this).addClass("alt");

});

Inline styles will override class change.

polyhedron