Layout with Java script | XM Community
Solved

Layout with Java script

  • 19 April 2024
  • 2 replies
  • 21 views

Userlevel 4
Badge +3

How do I adjust a Multiple Choice Single Answer question with Java script to display its choices in a single horizontal row, with the last choice positioned below?

 

These are the choices:

${q://QID97/ChoiceDescription/1}
${q://QID97/ChoiceDescription/4}
${q://QID97/ChoiceDescription/5}
${q://QID97/ChoiceDescription/6}
${q://QID97/ChoiceDescription/7}
${q://QID97/ChoiceDescription/8}
${q://QID97/ChoiceDescription/9}
${q://QID97/ChoiceDescription/10}

I want to make it look like this below:

 

I would appreciate any help!

icon

Best answer by ahmedA 19 April 2024, 22:49

View original

2 replies

Userlevel 7
Badge +21

Change the order of the options and make the second “N/A”.

Multiple Choice → Classic Layout → Alignment = Columns → Number of Columns = 7.

This way you’ll have choices 1,3,4,5,6,7 and 8 in row 1. And choice 2 in row 2.

Then expand the column in row 2 using this JS:

Qualtrics.SurveyEngine.addOnReady(function () {
const quest = this;
const qc = quest.getQuestionContainer();
qc.querySelector("tr.alt td.LabelContainer").colSpan = 999;
});

 

Userlevel 4
Badge +3

@ahmedA Thank you so much!

Leave a Reply