need JS to hide dropdown options in side-by-side matrix for one of the statements | XM Community
Skip to main content
Solved

need JS to hide dropdown options in side-by-side matrix for one of the statements

  • April 26, 2024
  • 3 replies
  • 93 views

Forum|alt.badge.img+5

This is my Q2 in the Qualtrics survey instrument in which I have a side-by-side table with 4 statements and 2 columns with dropdown options. For statements 2 and 3, I want to hide dropdown options for both columns.

 

Best answer by ahmedA

Qualtrics.SurveyEngine.addOnReady(function () {
const quest = this;
const qc = quest.getQuestionContainer();

const allRows = qc.querySelectorAll(".Choice");

const dropDowns = allRows[1].querySelectorAll("select");

dropDowns[0].disabled = true;
dropDowns[0].style.opacity = 0;
});

 

3 replies

Forum|alt.badge.img+22
  • Level 7 ●●●●●●●
  • 2050 replies
  • April 28, 2024
Qualtrics.SurveyEngine.addOnReady(function () {
const quest = this;
const qc = quest.getQuestionContainer();

const allRows = qc.querySelectorAll(".Choice");

allRows[1].querySelectorAll("select").forEach((dd) => {
dd.disabled = true;
dd.style.opacity = 0;
});
});

 


Forum|alt.badge.img+5
  • Author
  • Level 1 ●
  • 15 replies
  • April 28, 2024

thanks @ahmedA . This JS is working perfect. However, I realized that, for statement 2, I would like to hide the dropdown options from the first column and not the second one. 


Forum|alt.badge.img+22
  • Level 7 ●●●●●●●
  • 2050 replies
  • Answer
  • April 29, 2024
Qualtrics.SurveyEngine.addOnReady(function () {
const quest = this;
const qc = quest.getQuestionContainer();

const allRows = qc.querySelectorAll(".Choice");

const dropDowns = allRows[1].querySelectorAll("select");

dropDowns[0].disabled = true;
dropDowns[0].style.opacity = 0;
});