The sliderNumFormat function formats scale numbers (above the sliders) and values (appear when you drag a slider). It allows scale and value formats to be the same or different. The function uses Intl.NumberFormat() to format numbers in a variety of styles based on locale or locales. Some of the possibilities include:
sliderNumFormat works with all Qualtrics layouts including “New Survey Experience” (aka Simple layout).
Here is a simple example:
This function is available for a reasonable fee. Contact TomG on the Qualtrics Community to learn more.
<script src="https://cdn.jsdelivr.net/npm/jquery@3.7.1/dist/jquery.min.js">
Add the sliderNumFormat function to the survey header to make it available to any question in the survey. Go to Look & Feel → General → Header edit →
and paste the provided sliderNumFormat function JS:
<script>/*Paste sliderNumFormat function JS here*/</script>
Alternatively, paste the sliderNumFormat function JS into a question's JS outside the existing Qualtrics functions to make it available to questions on the page.
Add JS to call the sliderNumFormat function to apply it to the Slider question as follows:
Qualtrics.SurveyEngine.addOnload(function() {
sliderNumFormat(this);
});
To override the default options, specify the desired options in the second function argument as an object. For example:
Qualtrics.SurveyEngine.addOnload(function() {
sliderNumFormat(this,{format:{style:"currency",currency:"USD",maximumFractionDigits:0}});
});
format is a object used to specify the Intl.NumberFormat() formatting options. Options are specified the same way as in the Intl.NumberFormat() options object. format applies to both scale and value numbers.
Default: {} (empty, use Intl.NumberFormat() option defaults)
locale is a string or array that specifies the locale or locales to be used by Intl.NumberFormat().
Default: "en-US"
valueFormat is an object that specifies the Intl.NumberFormat() formatting options for value numbers. Options are specified the same way as in the Intl.NumberFormat() options object. If the same option is included in the format option the valueFormat option takes precedence.
Default: {}
scaleFormat is an object that specifies the Intl.NumberFormat() formatting options for scale numbers. Options are specified the same way as in the Intl.NumberFormat() options object. If the same option is included in the format option the scaleFormat option takes precedence.
Default: {}