Convert numbers to desired currency format. Javascript ES5
Can be called in the input blur event. Development required for keyup event to work.
inputElement.addEventListener('blur', function(){
this.value = formatMoney(this.value);
// this.value = formatMoney(this.value, 2, ',', '.');
});