I am trying to get a jQuery function to work on my Drupal 7 site, but I am having a difficult time to make it work.

This example works:

```
(function ($) {  

   Drupal.behaviors.theme = {

   attach: function (context, settings) {            

   $("#block-menu-3").css("background-color", "red");

   }

};})(jQuery);

```

But I am trying to do some a little more advanced stuff. For example: I want to apply black color to div B, only if div A is green.

So if I write

```
(function ($) {  

  Drupal.behaviors.theme = {

  attach: function (context, settings) {            

     $("div A").each(function(i){
       var color = $(this).css("background-color");
       if (color == "background-color:green;")
       $("div B").css("background-color", "");
       $("div B").css("background-color", "black");
     });

     }

 };})(jQuery);

```

Well it "works"....but div A could be any other color than green, and div B would become black under any circumstances....Im looking for the right way to wright the if statement....

So this does not work.....any help much obliged!