Add color background behind just one column on a matrix table question? | XM Community
Solved

Add color background behind just one column on a matrix table question?

  • 25 February 2019
  • 5 replies
  • 333 views

Badge +2
First time in the community and was searching for this, but didn't see this questions asked / answered. Sorry if I'm in the wrong category.

I'd like to add a background color (e.g., light gray) to just one column on a matrix table question (e.g., "Not sure / unable to judge" option). Thanks in advance!
icon

Best answer by Anonymous 25 February 2019, 21:23

View original

5 replies

Hello @ballred ,

Paste the below code in the matrix question js(OnReady) and update the column position in code:

var c= 1 //Enter the column position
var n=3+c;
jQuery("#"+this.questionId+" td.c"+n+" , th.c"+n+"").css("background","lightgrey");
Badge +2
You're an absolute legend, Shashi! Wizard indeed. Thanks so much 🙂
Badge +2
@Shashi: If you wanted to get crazy with the colors and pick a RGB code instead, how would you go about that? Sorry, so new to this stuff. Thanks!
> @ballred said:
> @Shashi: If you wanted to get crazy with the colors and pick a RGB code instead, how would you go about that? Sorry, so new to this stuff. Thanks!

Check this
Badge

Hi,
Also a first timer in the community. And definitely not a programmer. I am also trying to change one column in a question. It is a bipolar matrix question and I would like to change the colour of the middle column to light grey. It works when I paste the abovementioned code, but then it changes all the columns to grey. I am not sure where to enter the column number in the code to only change the middle column (Column number 4)?

Leave a Reply