How to add % to the numbers in a slider question | XM Community
Skip to main content

Hi, I have a slider question in my survey where I want the respondent to give a threshold as an answer, but what is shown on the slider is just numbers from 0 to 100. I wanted to know if it's possible to add % after at least 0 and 100.

Try the below code,
jQuery('#'+this.questionId+' .numbers').find('li').append('%')


Thank you, it worked. The only problem now is that there isn't enough space for 100% so % is shown below 100.
Capture.JPG


Try the below code:
jQuery("#"+this.questionId+" .numbers li").each(function(){

jQuery(this).text((jQuery(this).text()+"%").trim().replace(" ",""));

});


Thank you, it was great!


Hi, I just noticed that in the mobile view the numbers are very cramped now. Is it possible to limit the percent sign only to the first and last numbers?


https://www.qualtrics.com/community/discussion/comment/28985#Comment_28985Use this code:
jQuery("#"+this.questionId+" .first").text((jQuery("#"+this.questionId+" .first").text()+"%").trim().replace(" ",""));
jQuery("#"+this.questionId+" .last").text((jQuery("#"+this.questionId+" .last").text()+"%").trim().replace(" ",""));


I'm sorry, but could you also give me a code which puts % just for 100. I mean I don't want other numbers to have percentage sign.


https://www.qualtrics.com/community/discussion/comment/29377#Comment_29377jQuery("#"+this.questionId+" .last").text((jQuery("#"+this.questionId+" .last").text()+"%").trim().replace(" ",""));


This code: jQuery("#"+this.questionId+" .numbers li").each(function(){

jQuery(this).text((jQuery(this).text()+"%").trim().replace(" ",""));

});
produces 2 times the '%' symbol (example: 0%%). How can I delete one?


Leave a Reply