Hide check box in matrix question | XM Community
Skip to main content

Hello,
I'm trying to hide the marked check boxes. This way respondents wouldn't be able to select the same pairings twice.
BDo3YB5Zj-1ek_HD1JomhIfswegjJ11KxWmZWUdEvEjHODgvZM5ttulDEoCF7ACysGiYcdgd8yw5EcKMoN3cNf1x6hhFOsezmOUn9SxXA2gDCIXMmK0oHMMAkaAWOREk4ItObIfFAny help would be appreciated! Thank you in advance.

Hi,

  1. add a class to your look and feel -> style -> custom css:


.disabled{

/*background-color: red!important;*/
border: none !important;
}
2. add the below script to your question
Qualtrics.SurveyEngine.addOnload(function()
{
let qi = Qualtrics.SurveyEngine.QuestionInfo 
//console.log(qi)

let answers = qiithis.questionId].Answers // get the answers in your matrix question
//console.log(answers)


//loop through the answers

for(let answer in answers){

let element; //defines the element with the ids
let boxes; // defines the checkboxes (labels)

console.log(answer)

for (let i=1;i<=answer;i++){
element = document.getElementById('QR~'+this.questionId+'~'+answer+'~'+i)
console.log(element)
element.disabled = 'true'//disabling the input


boxes = element.parentElement.getElementsByTagName('label')
console.log(boxes)
for(let j=0;j console.log(boxessj])
boxessj].addClassName('disabled') //hiding the boxes by adding the disabled class

}

}
}
});


it looks like this:

image.png
I assume you can decrease the distance of the answer labels yourself :-)
hope this helps
Best regards

Rudi


Hi!
I am trying to do a similiar thing.
Do the labels for the checkboxes need to be anything specific in order for this code to work? It doesn't seem to do the trick for me 🙂



Hi,

sorry for getting back on this late. What exactly do you want to achieve? This would help me to answer your question. The above requirement was very special.

Best regards

Rudi


Leave a Reply