How to update slider bar "pop-up" value to match labels? | XM Community
Question

How to update slider bar "pop-up" value to match labels?

  • 7 November 2019
  • 2 replies
  • 57 views

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.

!

2 replies

Is there an answer to this somewhere?

Userlevel 7
Badge +22

Use Mutation Observer, check demo here.

Leave a Reply