JSFiddle - React, Tailwind, and code Playground
by mgrcic
HTML
<script src="https://raw.github.com/josscrowcroft/accounting.js/master/accounting.js"></script>
<input class="align-money" id="money-field" name="money-field" type="text" value="0,00">
CSS
.align-money {
text-align: right;
}
JavaScript
$(function() {
accounting.settings = {
number: {
precision: 2,
thousand: ".",
decimal: ","
}
}
$("#money-field").blur(function() {
var formattedValue = accounting.formatNumber($(this).val());
$(this).val(formattedValue);
});
});