Javascript to change question background color | XM Community
Skip to main content
Solved

Javascript to change question background color

  • May 24, 2023
  • 2 replies
  • 532 views

Forum|alt.badge.img+2

Would anyone be able to share JavaScript code to change the background color of individual questions, but leave the background color of the choices as is? Can’t be applied to the whole survey, just certain individual questions. I have a specific hex code, not a color name. Trying to mimic the idea below…

 

 

Best answer by Tom_1842

To change just the background color of the Question Text and change font color to white, you can try the below JavaScript:

jQuery("#"+this.questionId+" .QuestionText").css({"background-color":"#A20A35","color":"#FFFFFF"});

 

2 replies

Tom_1842
Level 8 ●●●●●●●●
Forum|alt.badge.img+28
  • Level 8 ●●●●●●●●
  • Answer
  • May 24, 2023

To change just the background color of the Question Text and change font color to white, you can try the below JavaScript:

jQuery("#"+this.questionId+" .QuestionText").css({"background-color":"#A20A35","color":"#FFFFFF"});

 


Forum|alt.badge.img+2
  • Author
  • Level 2 ●●
  • May 24, 2023

This worked! Thank you so much!