Hello, I hope someone here can help.
I am creating a slider style question in Qualtrics, that includes two statements within the question. The participant is required to provide a range of a total cost. Each statement (slider) represents a bound for the estimation. Slider 1 is the lowest bound, and Slider 2 is the highest bound for their cost estimate. I want the number in each statement to be converted to increments of 10,000, and have a $ added.
I have applied a mutation observer in JavaScript, which multiplies the result by 10,000, and add a $ symbol, to represent increments of $10,000 for each increment. The following JavaScript as follows was applied:
Qualtrics.SurveyEngine.addOnload(function()
{
/Place your JavaScript here to run when the page loads/
jQuery("ul.numbers").hide()
});
Qualtrics.SurveyEngine.addOnReady(function()
{
/Place your JavaScript here to run when the page is fully displayed/
jQuery("ul.numbers").hide()
// 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)*10000);
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/
});
However, this function only applies to the first slider, and would like to make it so it applies to both sliders. Secondly, I would like to make it so that a comma is added into each slider result, so that it differentiates thousands, hundeds of thousands etc ($10,000, $100,000, $1,000,000).
Please find attached a screenshot of the issue below:

For additional information, the slider question is set up so that it has 20 increments, and is NOT snapped. So it goes from 1-100. The first slider does convert to $10,000… etc, however the 2nd slider in the same question does not
Anyone know what I can do to fix it?