How do I check for a css value using jQuery?

Posted by zeckdude on Stack Overflow See other posts from Stack Overflow or by zeckdude
Published on 2010-05-31T03:24:51Z Indexed on 2010/05/31 3:32 UTC
Read the original article Hit count: 291

Filed under:
|

After the user clicks on a table row, I want it to check if the table row's background-color is white, and if so, it will change the color to light blue.

The code I am using is not working. Here it is:

$("#tracker_table tr#master").click(function(){
  if($(this).css("background-color") == "#FFFFFF") { 
    $(this).css("background-color", "#C2DAEF");
  }
});

I think there is something wrong with my if statement. How do I check for a css value using jQuery?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about css