How to change background color of a choice if it is hidden? | XM Community
Skip to main content
Hello,



I use Matrix Table --> Profile, Multiple Answer and hide some choices.

I want to change the background color of some rows. But I find that it seems that I cannot change the background color of the choices which are hidden. This makes the table look ugly.

Is it possible to change the background color?

(The attached file shows an example. Is it possible to change the background color of a whole row?)







Another question is that I want to limit the number of selected choices for the entire Profile, Multiple Answer question, not for only one of the multiple rows. The following is the code. But it doesn't work. What's wrong with it?



`//width of the columns

jQuery("#" + this.questionId).find("th.c1").css("width","18%");

jQuery("#" + this.questionId).find("th.c3").css("width","20.5%");

jQuery("#" + this.questionId).find("th.c4").css("width","20.5%");

jQuery("#" + this.questionId).find("th.c5").css("width","20.5%");

jQuery("#" + this.questionId).find("th.c6").css("width","20.5%");



//border-line

jQuery("#" + this.questionId).find("th.c1").css("border-right","solid");



//row background

var n = [0,1,3,4,5,6,8,12,17,21,22,23,24,26,30,31];

for(var k=0;k<n.length;k++){

jQuery("#" + this.questionId + " .ChoiceRow:eq(" + n[k] + ")").css("background","#DCDCDC");

};





//hide choices

var r = ["2,4","3,4","7,3","7,4","8,2","8,3","8,4","9,3","9,4","12,2","12,3","12,4","13,2","13,3","13,4"];



for(var i=0;i<r.length;i++){

var t1 = parseInt((r[i]).split(",")[0]);

var t2 = parseInt((r[i]).split(",")[1]);

jQuery("#"+this.questionId+" .ChoiceRow:eq("+(t1 - 1)+") .c"+(t2 + 3)+"").hide();

};



var rr = ["18,2","18,3","18,4","21,3","21,4","25,3","25,4","26,2","26,3","26,4","32,3","32,4"];



for(var i=0;i<r.length;i++){

var tt1 = parseInt((rr[i]).split(",")[0]);

var tt2 = parseInt((rr[i]).split(",")[1]);

jQuery("#"+this.questionId+" .ChoiceRow:eq("+(tt1 - 1)+") .c"+(tt2 + 3)+"").hide();

};



//limit to 5

this.questionclick = function(event,element){



var selectedchoice=this.getSelectedChoices();



if(selectedchoice.length==5){

jQuery("#"+ this.questionId +" input:checkbox:not(:checked)" ).attr("disabled", true);



}else{

jQuery("#"+ this.questionId +" input:checkbox:not(:checked)" ).attr("disabled", false);

};

};

`
Be the first to reply!

Leave a Reply