I am using following code to display currency in Indian numbering system:
<script type="text/javascript">
function format(obj) {
var formatted = obj.value.replace(/\D/g, '');
obj.value = formatted.replace(/(\d+)(\d{2})/g,'$1.$2');
}
</script>
<input type="number" onkeyup="format(this)">
Output I'm getting: 123456.78
Output I want is: 1,23,45,678.00
Please help!
You can use
Intl.NumberFormat
If that should be a currency, you can pass that as a second argument
Or to force the two decimals: