Using an unamed table cell's background color as a condition


#1

I know this seems a bit weird, but I was wondering if anyone knows a way to specify a background color of a table cell as a condition. I’m a fairly advanced user but this one has me stumped. I used javascript to change the color on click:
$(‘div[data-label=[[This]]]’).css(‘background-color’,’#FFFFFF’);

What I now need to do is test the color so that another click will change it again. I cannot rely upon a ‘selected’ state for a number of reasons, the chief one being that there are more than two states I need to test for.
I’ve tried things like "IF VALUE: document.getElementById([[This]]).style.backgroundColor EQUALS VALUE “#FFFFFF” but that syntax (along with all the others I tried) didn’t work.
Can anyone help me out?
Thanks in advance.


#2

Hi!

You’ll want to put the condition testing for the color in the same javascript where you set the color. E.g., (pseudo-code):

javascript:
if (color of div == color1) {
   color of div = color2;
} else if (color of div == color2) {
   color of div = color3;
}
...