Shading a column in a bipolar matrix | XM Community
Skip to main content
Solved

Shading a column in a bipolar matrix

  • July 13, 2020
  • 3 replies
  • 57 views

Forum|alt.badge.img

Hi,
I am trying to add shading to my middle column in a bipolar matrix. I have tried copying and pasting the following code:
var c= 1 //Enter the column position
var n=3+c;
jQuery("#"+this.questionId+" td.c"+n+" , th.c"+n+"").css("background","lightgrey");
BUT, is not sure where to change the column number?! If I copy and paste this into my survey, all my columns are shaded. Would greatly appreciate some advice.


Best answer by SurajK

Hi LduP ,
You can use the below code if you want to add color to 5th column,
jQuery("#"+this.questionId).find("tbody tr").each(function(){ jQuery(this).find("td").eq(5).css("background","lightgrey"); }) 
Likewise, you can simply change the eq() value as per your requirement.

3 replies

SurajK
QPN Level 3 ●●●
Forum|alt.badge.img+4
  • QPN Level 3 ●●●
  • Answer
  • July 13, 2020

Hi LduP ,
You can use the below code if you want to add color to 5th column,
jQuery("#"+this.questionId).find("tbody tr").each(function(){ jQuery(this).find("td").eq(5).css("background","lightgrey"); }) 
Likewise, you can simply change the eq() value as per your requirement.


Forum|alt.badge.img
  • Author
  • July 14, 2020

Hi SurajK ,
Thank you so much!! It works perfectly! Really appreciate your assistance. Thanks!


  • October 14, 2021

SurajK what would the code be if i wanted to shade a certain row, rather than a column? thanks!