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

Valerie_K Community Member Qubie ✭

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:

Thus, 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());

But this obviously does not account for any kind of calculation (nor work at all for that matter).

Any help would be greatly appreciated.