I've tried everything to automatically add comma separators (every thousand/hundred thousand etc) to a number that is automatically generated via a form.
I've tried:
<script type="text/javascript">//<![CDATA[
$(window).load(function(){
function numberWithCommas(x) {
return x.toString().replace(/\B(?=(?:\d{3})+(?!\d))/g, ",");
}
$('span#ninja_forms_field_83').each(function(){
var v_pound = $(this).html();
v_pound = numberWithCommas(v_pound);
$(this).html(v_pound)
})
});//]]>
</script>
But it's not working at all.
A link to the form is: http://freelance.tstwebdesign.co.uk/tyco/ You can see the value at the bottom change when you select different values.
Thanks in advance