How to add a "___ out of ___" type of question? | XM Community
Skip to main content

I want to add a math question that requires the subject to answer in proportions, so I want to add something like ___ out of ___ or similar to this, anyone knows how can I do it? 

There’s no defined question type for this.

What you can do is to create a form question with two fields which you can then move to the question HTML.

Example:

Question HTML:

<div><span class="dest" id="v1"></span> out of <span class="dest" id="v2"></span></div>

 

Question JS:

Qualtrics.SurveyEngine.addOnReady(function () {
const quest = this;
const qc = quest.getQuestionContainer();
const sources = qc.querySelectorAll(".InputText");
const destinations = qc.querySelectorAll(".dest");

destinations.forEach((dest, index) => {
const src = sourcescindex];
dest.insertAdjacentElement("afterbegin", src);
// To enforce only numbers
src.type = "number";
});
});

You can style the text boxes by using the selector .dest .InputText


Leave a Reply