I'm currently using a range slider for price ranges of £0 to £2,000,000. Currently, everything is working correctly apart from the prices not being formatted as currency (i.e the£500,000 value is currently being shown as £500000 - without the commas). Here's the code:
jQuery
/* SALES SLIDER */
$( "#slider-range-price-sales" ).slider({
range: true,
min: 0,
max: 2000000,
step: 50000,
values: [ 0, 2000000],
slide: function( event, ui ) {
$("#minPrice").val("£" + ui.values[0]).toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, "£1");
$("#maxPrice").val("£" + ui.values[1]);
}
});
$("#minPrice").val("£" + $("#slider-range-price-sales").slider("values", 0));
$("#maxPrice").val("£" + $("#slider-range-price-sales").slider("values", 1));
HTML
<div id="slider-range-price-sales"></div>
<div class="priceContainer">
<div class="left"><input type="text" id="minPrice" name="minPrice" style="border: 0; color: #3D80E9; background:#F2F2F2; font-weight: bold;" /></div>
<div class="right"><input type="text" id="maxPrice" name="maxPrice" style="border: 0; color: #3D80E9; background:#F2F2F2; font-weight: bold;" /></div>
</div>
http://jsfiddle.net/isherwood/RwfFH/
I've tried reformatting the minimum price with JavaScript .replace to no avail.. any help or suggestions would be greatly appreciated.
Thanks, jamie