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

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

  • 27 April 2024
  • 3 replies
  • 37 views

Userlevel 1
Badge +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.

 

icon

Best answer by ahmedA 29 April 2024, 06:17

View original

3 replies

Userlevel 7
Badge +21
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;
});
});

 

Userlevel 1
Badge +5

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. 

Userlevel 7
Badge +21
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;
});

 

Leave a Reply