Formidable Pro – Currency Formatting an Input Field (not a number field)

This article describes how you can use jQuery to manipulate single line text fields. For various reasons you will want to consider this as a visual perk, but not as something you would want to save to the database and use elsewhere.

jQuery currency format on keyup demo
$
$

 To achieve the above, we simply need to know the field keys and add the following to the Customize HTML “After Fields” box:

<script>
jQuery('#field_ev09g').on('keyup', function() {
var val = this.value;
val = val.replace(/[^0-9\.]/g,'');
jQuery(this).val(jQuery(this).val().replace(/[^0-9]/g, ''));

if(val != "") {
valArr = val.split('.');
valArr[0] = (parseFloat(valArr[0],10)).toLocaleString();
val = valArr.join('.');
}

jQuery('#field_78sue').val(val);
});

jQuery('#field_andel').on('keyup', function() {
var val = this.value;
val = val.replace(/[^0-9\.]/g,'');
jQuery(this).val(jQuery(this).val().replace(/[^0-9]/g, ''));

if(val != "") {
valArr = val.split('.');
valArr[0] = (parseFloat(valArr[0],10)).toLocaleString();
val = valArr.join('.');
}

this.value = val;
});
</script>

Enjoy!