So to put in other words: How can i display a manipulation of value of the slider.
It should adapt while respondents drag over the slider
Use JS to attach a mutation observer to the slider. Then update the displayed text value using whatever formula you want. It's not going to be possible via the default functionality, you'll need some custom programming.
Hi ahmedA,
I'm new to Javascript, do you happen to have a sample code which does what you said that I have take a look at?
Thank you in advance.
mf18 I pulled this code from developer.mozilla.org and modified it slightly. The Id in the first line of the code is the Id of the slider on my survey. Currently, when I move the slider, I get two console logs, one with a datetime stamp for I can see it working and the second with the value of the slider. Hope this helps!
Qualtrics.SurveyEngine.addOnload(function()
{
// Select the node that will be observed for mutations
const targetNode = document.getElementById("QID2~1~track");
// Options for the observer (which mutations to observe)
const observerOptions = { attributes: true, childList: true, subtree: true };
// Create a new instance of `MutationObserver` named `observer`,
// passing it a callback function
function callback() {
console.log("Inside callback at " + Date.now());
console.log("slider value: " + targetNode.valueOf().textContent);
}
const observer = new MutationObserver(callback)
// Start observing the target node for configured mutations
var x = observer.observe(targetNode, observerOptions);
});
WolfKeppens Did you eventually solve your original question from above?
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.