You are viewing limited content. For full access, please sign in.

Question

Question

Change color of label of a radio button in a table

asked on February 1, 2022

I have 2 tables.  In table 1 I have 2 questions that are radio button Yes/No answer questions.  If the answer to row 1 is Yes or No the field should remain green, but if the answer to row 2 is Yes, the color should change to orange.  BUT in table 2, if either answer to row 1 or 2 is Yes, the background should change to orange.

I have done this like this in css and I know this will change any answer to orange if the answer is Yes, but I'd like to override that in java just for table 1 row 1 so that No or Yes would remain green just for that row.

Here is what the form answers look like:

And here is the css code I am currently using.

.radioYN input[value='1']:checked + label{
  background-color: #FDB102;
  color:white;}
.radioYN input[value='0']:checked + label{
  background-color: #58F952;
  color:black;}

 

 

 

0 0

Answer

SELECTED ANSWER
replied on February 1, 2022

I got it!

I added a css class to both tables, then used this code:

.tblConfidentialityQ tr:nth-child(odd) .radioYN input[value='1']:checked + label{
  background-color: #58F952;
  color:black;}
.tblConfidentialityQ tr:nth-child(odd) .radioYN input[value='0']:checked + label{
  background-color: #58F952;
  color:black;}

.tblConfidentialityQ tr:nth-child(even) .radioYN input[value='1']:checked + label{
 background-color: #FDB102;
  color:white;}
.tblConfidentialityQ tr:nth-child(even) .radioYN input[value='0']:checked + label{
  background-color: #58F952;
  color:black;}

.tblIntegrityQ .radioYN input[value='1']:checked + label{
  background-color: #FDB102;
  color:white;}
.tblIntegrityQ .radioYN input[value='0']:checked + label{
  background-color: #58F952;
  color:black;}

3 0

Replies

You are not allowed to reply in this post.
You are not allowed to follow up in this post.

Sign in to reply to this post.