Dynamically integrate a slider value in a same-page follow-up question | XM Community
Question

Dynamically integrate a slider value in a same-page follow-up question


Hello Qualtrics Community,
I am trying to dynamically extract the value of a slider question and display it in a mathematically manipulated form in a consecutive question on the same page.
Specifically, my question looks something like the example below:
image.pngThus, in the bottom text I would like to display the price a respondent would have to pay given the protein and quantity they selected. So, for example, if someone selects chicken breasts and 10lbs., then on the bottom it would show $20.
The Javascript I tried so far was:
jQuery("input[type = hidden]").change(function () {
if(jQuery("#QID202~1~true-result").val().length == 0){
var sliderScore = 0;
} else{
var sliderScore = parseInt(jQuery("#QID202~1~true-result").val());
}
jQuery("#totalscore").html(sliderScore);
jQuery("#totalscore").text(sliderScore);
Qualtrics.SurveyEngine.setEmbeddedData("eJStotalscore",sliderScore);
});
});
But this obviously does not account for any kind of calculation (nor work at all for that matter).
Any help would be greatly appreciated.

Best,
Valerie


0 replies

Be the first to reply!

Leave a Reply