Get a slider value and write in the question | XM Community
Skip to main content
Hi everyone,



I want to get a value from the slider and write that down in the question



I don't know but it is not working



Could someone help me?



=========================================================

Qualtrics.SurveyEngine.addOnReady(function()

{



var val = jQuery("#QID58\\~1\\~true-result").slider("option", "value");

document.getElementById("upload1").innerHTML = val



});



===================================



Then use span function in the main html text



Thank you so much in advance
Hi @emabed could you not just do this with piped text, rather than custom code?
I was thinking on the same. you can do this with piped text using the question selected choices

https://www.qualtrics.com/community/discussion/comment/20000#Comment_20000Hello Clair,

how does one achieve this with a piped text?


You can't pipe the value until the page after the slider. I'm assuming you want the slider value in question text of the slider question. Two things:

  1. The first line of your JS wrong. You need to double escape ~. There really isn't any need to hard code QID numbers. Also, there is not a jQuery slider function (unless you are using a jQuery ui slider - which a Qualtrics slider isn't). The correct JS would be:
     jQuery("#"+this.questionId+" .ResultsInput").val();

  2. Even if your JS were correct, you would only be displaying the initial value of the slider when the page loads. You need to use a MutationObserver to update the value each time the slider value updates.


mihaidricu If piped text does end up being a good solution, there is a detailed help page here: https://www.qualtrics.com/support/survey-platform/survey-module/editing-questions/piped-text/piped-text-overview/
And this image shows how you get to it: https://www.qualtrics.com/support/wp-content/uploads/2018/02/piped-text-01.png


Leave a Reply