Hi everyone,
I'm using a slider question to record a participant's willingness to pay for a certain product as part of an economics experiment. This WTP value will be compared to a randomly generated value in the survey flow. Unfortunately I've not been able to extract the value from the slider and set it to an embedded data field.
My JS so far on the slider question is:
Qualtrics.SurveyEngine.addOnload(function()
{
/*Place your JavaScript here to run when the page loads*/
var randomNum = (Math.random() * (0.21 - 0.0) + 0.0).toFixed(2);
Qualtrics.SurveyEngine.setEmbeddedData("WTP_Random", randomNum);
console.log(randomNum);
});
Qualtrics.SurveyEngine.addOnReady(function()
{
var value;
var that = this.questionId;
jQuery(document).on('change',function(){
value=parseInt(jQuery("[id='"+that+"~1~result']").val());
});
console.log(value);
Qualtrics.SurveyEngine.setEmbeddedData("WTP_Subject", value);
});
Qualtrics.SurveyEngine.addOnUnload(function()
{
/*Place your JavaScript here to run when the page is unloaded*/
});
Any help would be greatly appreciated.
Thanks, Chris
Question
Using Javascript to get slider value and save to embedded data
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.

Add a page break after this question and then add a dummy descriptive question. Pipe both the embedded data in this dummy question.