You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 25, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 25, 2026. It is now read-only.
Add commas for numbers/pricing for jQRangeSlider #225
I then bind the function to do a bunch of sorting in my HTML:
jQuery("#slider").bind("valuesChanging", function(e, data) { pricingSort(data.values.min, data.values.max); });
However, this is a price range, I include a dollar sign using a CSS before pseudo.
For anyone stuck on this, I found a solution using a before pseudo element and a html data attribute in the HTML with CSS/jQuery (not sure if it is the best solution):
// Set values for page load.
jQuery(".ui-rangeSlider-leftLabel .ui-rangeSlider-label-value").attr("data-value", "350,000");
jQuery(".ui-rangeSlider-rightLabel .ui-rangeSlider-label-value").attr("data-value", "600,000");
// Set values when user uses the slider.
jQuery("#slider").bind("valuesChanging", function(e, data) {
jQuery(".ui-rangeSlider-leftLabel .ui-rangeSlider-label-value").attr("data-value", data.values.min.toLocaleString(
undefined, // use a string like "en-US" to override browser locale
{ minimumFractionDigits: 0 }
));
jQuery(".ui-rangeSlider-rightLabel .ui-rangeSlider-label-value").attr("data-value", data.values.max.toLocaleString(
undefined, // use a string like "en-US" to override browser locale
{ minimumFractionDigits: 0 }
));
});
Activity
s-wild commentedon Aug 21, 2017
For anyone stuck on this, I found a solution using a before pseudo element and a html data attribute in the HTML with CSS/jQuery (not sure if it is the best solution):
Which will make the HTML look like this:
I then use css content (with a bit of a hacky way of hiding the existing values being displayed):
Then voila, we have our commas:
[-]Added commas onto display for numbers[/-][+]Add commas onto display for numbers/pricing[/+][-]Add commas onto display for numbers/pricing[/-][+]Add commas for numbers/pricing for jQRangeSlider[/+]ghusse commentedon Aug 21, 2017
You can simply use the formatter option: https://ghusse.github.io/jQRangeSlider/options.html#formatterOption