Dynamically update slider scale text | XM Community
Skip to main content

Based on the exchange here, I am using JavaScript to capture the value of a sliding scale and to dynamically display that value in the question text. Here is a screenshot in which the question text displays the current value of the slider scale:

 

 

The HTML of the question text includes the following code:

<b><p id="alreadyKnewPercentage"> </p>
<p id="newPeoplePercentage">&nbsp;</p></b>

 

I would ideally like to dynamically display the value of the sliding scale within the scale labels (directly above “0” and “100”) rather than in the question text. However, when I place the code above into the scale labels, the value of the slider does not show up. Any help would be much appreciated!

I think adding the HTML in label should solve it.


Although the HTML originally did not work when I placed it in the scale labels, it turns out that this is because the JavaScript I used can only dynamically update the value in one place at a time. So when I add the HTML to the scale labels, AND remove it from the question text, the HTML now displays the value in the scale labels as intended.


Leave a Reply