How can I limit my slider question to only multiples of 0.5? | XM Community
Solved

How can I limit my slider question to only multiples of 0.5?

  • 11 February 2019
  • 3 replies
  • 103 views

Hi, I have a slider question in my survey and the answer ranges from -25 to 25%. I would like to limit the answer to go up in multiples of 0.5, i.e 1.5%, 2%, 2.5%.... Rather than answers include 2.1% or 1.8%. Is this possible?
icon

Best answer by Anonymous 11 February 2019, 14:57

View original

3 replies

Userlevel 7
Badge +23
I know of the option to use the number of grid lines and select "snap to grid", like the below:
!
But the top of the table will look crazy:
!

Use the below Java Script code on ready to remove the crowded values in this question:
`jQuery("#"+this.questionId+" .numbers").hide();`
Hello @DJRichardson ,

With the settings mentioned by @Mslreen , you can also use the below code to show only few values of the slider. Change the value of 'n' in the below code to change the visibility of the slider numbers.

var that = this.questionId;
var n=20;
jQuery("#"+that+" .numbers li").hide() ;
for(var i=0; i<=100;i++){
if(i%n==0){
jQuery("#"+that+" .numbers li:eq("+i+")").show();
}
}
Hi Mslreen & Shashi,

Thanks so much for this help. I applied both answers and managed to incorporate this into my survey.

Daniel

Leave a Reply