Has anyone found a solution to add a "," to the slider options? Trying to show slider options as "$0", "$100,000", "$200,000", "$300,000, "$400,000", "$500,000". Thanks for any help!
I pasted the JavaScript into the right place and there is no change to the slider. Did I miss something?
Qualtrics.SurveyEngine.addOnload(function()
{
/*Place your JavaScript here to run when the page loads*/
});
Qualtrics.SurveyEngine.addOnReady(function()
{
var s=["$0","$1,000,000","$2,000,000","$3,000,000","$4,000,000","$5,000,000","$6,000,000","$7,000,000","$8,000,000","$9,000,000","$10,000,000"];
for(var i=0;i<s.length;i++){
jQuery(".TickContainer span:eq("+i+")").html(s[i]);
}
});
Qualtrics.SurveyEngine.addOnUnload(function()
{
/*Place your JavaScript here to run when the page is unloaded*/
});
The code only applies to constant sum sliders, not slider questions.
You might be interested in the sliderNumFormat function. If so, contact me by private message.
See below for the code that works…
Qualtrics.SurveyEngine.addOnload(function()
{
/*Place your JavaScript here to run when the page loads*/
});
Qualtrics.SurveyEngine.addOnReady(function()
{
var $this = jQuery(this.questionContainer);
var s = [
"$0","$1,000,000","$2,000,000","$3,000,000","$4,000,000","$5,000,000",
"$6,000,000","$7,000,000","$8,000,000","$9,000,000","$10,000,000"
];
for (var i = 0; i < s.length; i++) {
jQuery(".QuestionBody .labels-container .numbers li:eq(" + i + ")", $this).html(' ' + s[i] + ' ');
}
let mo = new MutationObserver(function() {
let val = jQuery(".sliderToolTip .sliderToolTipBox", $this).text();
if (!val || val.indexOf('$') != -1) {
return;
}
val = '$' + new Intl.NumberFormat('en-US', { maximumSignificantDigits: 3 }).format(val);
jQuery(".QuestionBody .sliderToolTip .sliderToolTipBox", $this).text(val);
});
mo.observe(jQuery(".QuestionBody .sliderToolTip", $this)[0], { attributes: true, attributeFilter: ['style'] });
});
Qualtrics.SurveyEngine.addOnUnload(function()
{
/*Place your JavaScript here to run when the page is unloaded*/
});
----------------------------------------
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.