Calculation based on Piped Text & Piped Text in the question description based on the answer of question | XM Community
Skip to main content

Hello. I was wondering how I can achieve the above function on qualtrics?

  1. When the participants choose a value on the slider (say x), the description of the question will update the x value.
  2. In addition, it will be automatically calculated on the page that what is 1000 - x

@Zack 

You can include below in HTML of question. 

Your investment is <span id="xValue"></span><br>
Your budget left is (1000 - x) = <span id="Value"></span>

And include below in JavaScript of question, but update the id of slider track in below JavaScript.

Qualtrics.SurveyEngine.addOnReady(function () {
jQuery('#' + this.questionId).change(function () {
var x = jQuery('yid="QID162~4~track"]').attr('aria-valuenow');
jQuery("#xValue").text(x);
jQuery("#Value").text(1000 - x);

});
});

Hope it helps!


Leave a Reply