Change Slider Question Values | XM Community
Skip to main content
Hi,



Currently working on a survey in which I'm using the slider question and I want the slider to start at 1 and go to 100 with the grid line values being at 10, 20, 30,...,90, 100. At present, I have the settings as follows:

Min value: 1

Max value: 100

Grid lines: 10

and the question looks like this

!



Is there anything I can do (js code? question settings?) to change the grid line values to match what I need them to be at (10, 20, 30, .... ,90, 100)?
Hi @KS28 , is there a reason you don't want it to start at 0? That would fix this issue.
Hi @ClairJ ! Thanks for your response! So I didn't want to start at 0 because in my previous question I ask if they want to put some percent of the refund into their account and they only see the slider question if they say yes to the previous question so there is an implicit assumption that they will put at least 1 percent
Hi @KS28 ,

you can access any element using CSS selectors and modify its HTML content.

Try the following code:



Qualtrics.SurveyEngine.addOnload(function()

{

var myCSS = "#" + this.questionId + " .q-slider .horizontalbar .numbers li";

var n = jQuery(myCSS).length;



var JQ, i, val;



for (i = 1; i < n; i++)

{

JQ = jQuery(myCSS + ":nth-of-type("+i+")");

val = Number(JQ.html());



JQ.html(val + 1);

}

});
@fleb Thank you! The code was very helpful!
@KS28 got it...glad you found a solution!
@fleb Doesn't this only change the displayed text? Is there a way to actually change the value?

Leave a Reply