Shading a column in a bipolar matrix

LduPLduP Community Member Qubie ✭
edited July 13 in Custom Code

Shading a column in a bipolar matrix

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

  • SurajKSurajK India Sage ✭✭✭
    Accepted Answer

    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.

Answers

  • LduPLduP Community Member Qubie ✭

    Hi SurajK ,

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

Sign In to Comment