Formatting values on constant sum slider as $USD | XM Community
Skip to main content

Hi all,

 

I’m using a constant sum slider for a funding distribution task. I’d like to show the slider values in $USD format — so the constant sum slider would range from $0 to $50,000, for example. Does anyone know if this can be done using Javascript or CSS? My question is very similar to this one, but I can’t figure out how to adapt the code for a constant sum slider: 

Many thanks!

We cannot put any character in constant sum text box other than number, hence we cannot add ‘$’ in text box.If you are asking to change the number format above slider then it can be done using below JS:

jQuery(".TickContainer:eq(1) .MinValue").text("$0");
jQuery(".TickContainer:eq(1) span:eq(1)").text("$5,000");
jQuery(".TickContainer:eq(2) span:eq(0)").text("$10,000");
jQuery(".TickContainer:eq(3) span:eq(0)").text("$10,000");
.
.
.
jQuery(".TickContainer:eq(10) span:eq(0)").text("$10,000");

But adding extra characters will disturb the alignment of the labels, so make sure to have very few labels.


Leave a Reply