-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add commas for numbers/pricing for jQRangeSlider #225
Comments
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: |
You can simply use the formatter option: https://ghusse.github.io/jQRangeSlider/options.html#formatterOption |
I have this code here which initiates the slider:
jQuery("#slider").rangeSlider({ bounds: { min: 300000, max: 625000 }, defaultValues: { min: 350000, max: 600000 }, step: 25000 });
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.
I now want to include a comma between number values. I know I can use: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toLocaleString to convert the number, but this will mess up my filtering as it is set to an integer and not a string.
Is there a way to display a value and a label using this library?
The text was updated successfully, but these errors were encountered: