After hiding "0" on a slider bar, how to prevent the remaining numbers from stretching to the left? | XM Community
Skip to main content

After hiding "0" on a slider bar, how to prevent the remaining numbers from stretching to the left?

  • October 30, 2022
  • 2 replies
  • 32 views

Forum|alt.badge.img+1

I was able to disable 0 on my slider bar (reset the value to 1 when users click 0), and hide the number 0 with the following codes:
Qualtrics.SurveyEngine.addOnload(function()
{
    if(result>0 && result<10) {
        otherend = 10 - result;
        jQuery(".result").html(result);
        jQuery(".otherend").html(otherend);
    } else if (result == 0) {
        jQuery(".ResultsInput").val(1);
        jQuery(".result").html(1);
        jQuery(".otherend").html(1);
}
});

 jQuery(".numbers li.first").hide();
});

But then, all remaining numbers (1-10) stretches to the left. As a result, grid “1“ on the slider now locates in the middle of the numbers 1 and 2. Is there any solution to this stretching issue? Thanks!
image.png

2 replies

Deepak
QPN Level 8 ●●●●●●●●
Forum|alt.badge.img+46
  • October 30, 2022

sirius
If it's just the stretching issue, you can replace the last line with the below code.
jQuery(".numbers li.first").css("visibility","hidden");
It will eliminate the numbers moving to left.
Hope it helps!


Forum|alt.badge.img+1
  • Author
  • October 30, 2022

Yes it worked!
Thank you very much Deepak :)