Having an absolute nightmare trying to figure out how to format a number with Revolution Slider.
I have an unformatted price coming from properties within property hive and need to format it.
The slider will only return the unformatted price. I have learned that with a little JQuery targeting a div containing the price, it could be possible to format the number into UK currently format. But I just cant work it out.
It would be great if anyone has an idea or even a solution. I’ve suddenly gone bald by way of pulling my hair out!
Html: <span class="revSliderPrice">%meta:_price%</span>
Here is the code under JS section using EVENT:
jQuery(function ($){
revapi39.bind("revolution.slide.onchange",function (e,data) {
var priceAmt = $(".revSliderPrice").html();
$(".revSliderPrice").text('$' + parseFloat(priceAmt, 10).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, "ÂŁ1,").toString());
});
});
…or maybe I could forget the revslider part and just ask, is there a way using JS to target a span/div class and format the number within that to currency decimals?
Is there a way that could be done?