Save slider response as embedded data and NaN | XM Community
Question

Save slider response as embedded data and NaN

  • 13 June 2021
  • 1 reply
  • 34 views

Hi, I want to save a slider's response as embedded data and use it as the start position in next block's slider question.
Here is my code:
Qualtrics.SurveyEngine.addOnReady(function()
{
var qobj = this;
var qid = this.questionId;
jQuery( "#"+qid ).on('change', function(){
var response = parseInt(jQuery("#"+qid+"\\\\~1\\\\~true-result").val());
Qualtrics.SurveyEngine.setEmbeddedData("ResponseTime", response);
});  
});
But the embedded data ResponseTime is NaN. Can someone tell me what is the problem? I think the error is from
var response = parseInt(jQuery("#"+qid+"\\\\~1\\\\~true-result").val());
but how can I access the response of this slider question? many thanks!!
i also tried the following two, but none of them work:
var response = parseInt("${q://QID23/ChoiceNumericEntryValue/1}");

var response = this.getChoiceValue(1);
another question is how I can use javascript to set slider's start position?


1 reply

Userlevel 7
Badge +21

console.log(this.getChoices()) to see the actual choice id of your slider. Its possible you made some changes and now your slider id is probably 4 or something.

Leave a Reply