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

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;
}

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


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


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.


Leave a Reply