How to update slider bar "pop-up" value to match labels? | XM Community
Skip to main content
Hi,



See pic of survey below. I'd like to add JS code to update the slider question's scale popup label. For example, the popup scale label should read "(1) Extremely Satisfied" instead of "1", "(2) Somewhat Satisfied" instead of "2"



I'm familiar with general code to change slider scale nums:

var myCSS = "#" + this.questionId + " .q-slider .horizontalbar .numbers li";

var n = jQuery(myCSS).length;

JQ = jQuery(myCSS + ":nth-of-type("+1+")");

val = Number(JQ.html());

JQ.html(val)



→Using that general method I tried selecting using .q-slider slider-container, and changing the value. I was able to change the value, but as soon as you click/drag/move the slider it was overwritten and never displayed. Help me find a way to stop that from happening?



Thanks.



!

Is there an answer to this somewhere?


Use Mutation Observer, check demo here.


Leave a Reply