How to add Percentages to Incremental Value on a Slider Question | XM Community
Skip to main content

I am trying to add percentage symbols for the values given on the increments for the slider question- is there a java code or some capabilities through qualtrics to allow me to do this? 

If you want to add % signs to the scale, you can do this (code for “New Experience” would be different):

Qualtrics.SurveyEngine.addOnload(function() {
jQuery("#"+qobj.questionId+" ul.numbers li").each(function() {
this.innerText = this.innerText + "%";
});
});

 


When I add it to the java script, should it look like this? When I input it this way, I still don’t get the % symbols next the incremental values on the scale. 

 


Oops, I copied it from somewhere else and forgot to change a variable name.  Corrected:

Qualtrics.SurveyEngine.addOnload(function() {
jQuery("#"+this.questionId+" ul.numbers li").each(function() {
this.innerText = this.innerText + "%";
});
});

 


Thank you so much, Tom! This worked! 


Hi ​@TomG , I just tried this and it isn’t working. My javascript is:

 

Qualtrics.SurveyEngine.addOnload(function() {
    jQuery("#"+this.questionId+" ul.numbers li").each(function() {
        this.innerText = this.innerText + "%";
    });
});

Qualtrics.SurveyEngine.addOnReady(function()
{
    /*Place your JavaScript here to run when the page is fully displayed*/

});

Qualtrics.SurveyEngine.addOnUnload(function()
{
    /*Place your JavaScript here to run when the page is unloaded*/

});

Do you know what the issue could be? Thanks!


@ranibawa,

My guess is that your question type is Constant Sum instead of Slider. If it is Constant Sum use:

Qualtrics.SurveyEngine.addOnload(function() {
jQuery("#"+this.questionId+" .TickContainer span").each(function() {
this.innerText = this.innerText + "%";
});
});

 


Hi ​@TomG , thanks for your quick response. My question type is Slider, see the attached screenshot. I’m not sure why it wouldn’t work.


@ranibawa - Can you post a block preview screenshot of it? Better yet if possible, a public block preview link?


Hi ​@TomG -- here is a link to the block preview: https://osu.pdx1.qualtrics.com/jfe/preview/previewId/143b62dd-38bb-484a-98f5-e782bfd1be4c/SV_6xPO8iVkRxKQpUO/BL_3ITlnwNKIW7EidE?Q_SurveyVersionID=current


It isn’t public, it requires login.


https://osu.pdx1.qualtrics.com/jfe/preview/previewId/143b62dd-38bb-484a-98f5-e782bfd1be4c/SV_6xPO8iVkRxKQpUO/BL_3ITlnwNKIW7EidE?Q_SurveyVersionID=current Try this one, sorry about that! ​@TomG 


Aha! It is because Mobile Friendly is turned off.  Use the same JS that I provided for Constant Sum:

Qualtrics.SurveyEngine.addOnload(function() {
jQuery("#"+this.questionId+" .TickContainer span").each(function() {
this.innerText = this.innerText + "%";
});
});

 


@TomG Great, that fixed it! Thank you SO much!


Leave a Reply