Best answer by MsIreen
View originalHow do I customize/format slider scale options?
Hi qualfun ,
You can achieve the same(to prepend "$" in show value") using the below code by adding below code into Qualtrics JS API:
Qualtrics.SurveyEngine.addOnload(function()
{
/*Place your JavaScript here to run when the page loads*/
});
Qualtrics.SurveyEngine.addOnReady(function()
{
/*Place your JavaScript here to run when the page is fully displayed*/
// Select the node that will be observed for mutations
const targetNode = document.getElementsByClassName("sliderToolTipBox")[0];
let observer = new MutationObserver(function() {
targetNode.innerHTML ="$"+ Math.abs(targetNode.innerHTML);
observer.disconnect(); // turn observer off;
observer.observe(targetNode, {
attributes: true,
childList: true, // observe direct children
subtree: true, // and lower descendants too
characterDataOldValue: true // pass old data to callback
});// turn back on
});
// observe everything except attributes
observer.observe(targetNode, {
attributes: true,
childList: true, // observe direct children
subtree: true, // and lower descendants too
characterDataOldValue: true // pass old data to callback
});
});
Qualtrics.SurveyEngine.addOnUnload(function()
{
/*Place your JavaScript here to run when the page is unloaded*/
});
https://www.qualtrics.com/community/discussion/comment/28479#Comment_28479Use a JS Mutation Observer.
https://www.qualtrics.com/community/discussion/comment/10359#Comment_10359Hi Mslreen, is there a way to add this to the popup numbers on the moving slider itself?
> You have to use JavaScript to do this.
Does anyone have the JS? I do not want to use Custom CSS because I only want this feature for certain questions on my survey, not the entire survey.
The CSS code did not work. Is there javascript you recommend?
The CSS code did not work. Is there javascript you recommend?
Paste the below CSS in Add Custom CSS
ul.numbers li::before{
content: "$";
}
Note: Adding "$" may disturb the layout in mobile-view. Please check on this
Leave a Reply
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.