jquery - Prepend a number with $ in javascript -
i have small script ( using nouislider )
i wish prepend rangething values $ sign outputting prices.
code have is:
$("#slider").nouislider({ range: [0, 1000000] ,start: [350000, 700000] ,handles: 2 ,step: 50000 ,slide: function(){ var values = $(this).val(); $("span.rangething").text( values[0] + " - " + values[1] ); } ,serialization: { to: [$("#exto"),$("#exfr")] ,resolution: 1 } });
the javascript creates span <span class="rangething"></span>
the output format 200000 - 350000
i format ( commas ) thousand separators, thats gonna messy. trying prepend 2 sets of values $ sign signify price.
so resultant output $200000 - $350000
i tried changing values this, didnt work lol.
$("span.rangething").text( + "$" + values[0] + " - " + + "$" + values[1] );
i not sure if on right track, , fact trying echo $ culprit, , perhaps should use unicode, either way isnt working.
help appreciated
do in 1 line see what's going on:
- you starting
+
- the third line has double
+
one line easier read:
$("span.rangething").text("$" + values[0] + " - $" + values[1]);
Comments
Post a Comment