Shading a column in a bipolar matrix | XM Community
Solved

Shading a column in a bipolar matrix

  • 13 July 2020
  • 3 replies
  • 22 views

Badge

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.


icon

Best answer by SurajK 13 July 2020, 23:56

View original

3 replies

Userlevel 5
Badge +4

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.

Badge

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

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

Leave a Reply