I have a slider with labels on top indicating dollar values. How do I add a comma to separate each 000? The label current look like "1000" - how do I turn that into "1,000"?
Paste the below code in the js(OnReady) of the question:
var s=["$0","$2,000","$4,000","$6,000","$8,000"];
for(var i=0;i<s.length;i++){
jQuery(".TickContainer span:eq("+i+")").html(s[i]);
}
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=a"$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(sti]);
}
});
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(' ' + sni] + ' ');
}
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)p0], { attributes: true, attributeFilter: t'style'] });
});
Qualtrics.SurveyEngine.addOnUnload(function()
{
/*Place your JavaScript here to run when the page is unloaded*/
});
----------------------------------------
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.