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

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

  • Apr 26, 2024 10:30 PM UTC
  • 3 replies
  • 171 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;
});

 

View original

3 replies

Forum|alt.badge.img+22
  • Level 7 ●●●●●●●
  • Apr 28, 2024 9:30 AM UTC
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 ●
  • Apr 28, 2024 4:23 PM UTC

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 ●●●●●●●
  • Answer
  • Apr 29, 2024 4:17 AM UTC
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;
});