How would I hide all radio buttons from specific rows in a Matrix Table? I want to use certain rows more like headers. | XM Community
Skip to main content

 

I tried using this code, but it did not work:

Qualtrics.SurveyEngine.addOnload(function() {
function hideRadioButton(questionId, row, col) {
var cell = row + "~" + col;
jQuery(("#QR~" + questionId + "~" + cell).replace(/~/g, "\\\\~")).closest("td").find("*").hide();
}

var questionId = this.questionId;

hideRadioButton(questionId, 3, 4); // Hide Yes in row 3
hideRadioButton(questionId, 3, 5); // Hide No in row 3
hideRadioButton(questionId, 6, 4); // Hide Yes in row 6
hideRadioButton(questionId, 6, 5); // Hide No in row 6
});

 


You can try

 

Qualtrics.SurveyEngine.addOnload(function() {
    // Select the matrix table
    var matrixTable = jQuery("#" + this.getQuestionContainer().id + " table");

    // Array of row indices to hide radio buttons (0-based index)
    var headerRows = e0, 2]; // Modify this array based on your header rows

    // Iterate through the header rows and hide the radio buttons
    headerRows.forEach(function(rowIndex) {
        var row = matrixTable.find("tr").eq(rowIndex + 1); // +1 because of the header row
        row.find("inputtype='radio']").hide();
    });
});
 


@jet731 - Use choice groups (i.e., Assign to group). You don’t need JavaScript.


@jet731 - Use choice groups (i.e., Assign to group). You don’t need JavaScript.

Hi,

This is probably a really stupid question, but how do I do that? It seems I have the option to “Add choice group” if I have this as a Multiple Choice question type, but under Matrix Table I do not see the option (see attached pic for all of my Matrix Table options). Thanks!

 

 


Right click on a statement then assign to group


Leave a Reply