CSS code for toggle the color of a single answer choice text for multi choice question when checked | XM Community
Skip to main content
Question

CSS code for toggle the color of a single answer choice text for multi choice question when checked


Forum|alt.badge.img+2

I have a question82 that asked “whether you have a serious illness that will impacting your function?” with single answer choice of Yes or NO. Once Yes is selected, I wanted the “Yes” word  to be highlighted with RED color and Yellow background. Below CSS script I inserted into the Look and Feel -? Style section of CSS box. Test it but it is not firing up the action on Q82. Can someone help to let me know where did I  do wrong? Thanks.

 

.Skin #QID82 label.SingleAnswer.q-checked {
    background:#ff0000;
   color: #ffff00;
}

3 replies

Forum|alt.badge.img+12
  • QPN Level 3 ●●●
  • 38 replies
  • July 26, 2023

Apply the css at run time using Javascript in question itself and make sure you use the correct QID.


Shivamvig_sv
Level 6 ●●●●●●
Forum|alt.badge.img+14
  • Level 6 ●●●●●●
  • 69 replies
  • July 27, 2023

the CSS code you provided is targeting the label element with the class "SingleAnswer" that has been checked (q-checked) for question 82. the CSS code itself looks correct, and the issue might be due to Incorrect question ID: Make sure that the question ID is indeed "QID82". Double-check the question ID in your survey or form to ensure it matches with the CSS code.

 

also try clearing your cache once


Forum|alt.badge.img+2
  • Author
  • Level 1 ●
  • 3 replies
  • July 31, 2023

Thanks Imran and Shivamvig for the guidance. If I just  what the answer = Yes then the Label Yes  highlighted (but not No) ,  how the script would look like? Thanks.