Post

Replies

Boosts

Views

Activity

Replace decimal point with comma in an input
My APP is for the Spanish market and I can't get it to convert into a decimal point when entering a comma, I have this code, any ideas, thanks <ion-input autofocus="true" placeholder="0.00" onkeypress="this.value = this.value.replace(/^0+/, '').replaceAll(',', '.').replace(/[^\d.]/g,'').replace(new RegExp('(^[\d]{7})[\d]', 'g'),'$1').replace(/(..)./g, '$1').replace(new RegExp('(\.[\d]{2}).','g'),'$1')" onkeyup ="this.value = this.value.replace(/^0+/, '').replaceAll(',', '.').replace(/[^\d.]/g,'').replace(new RegExp('(^[\d]{7})[\d]', 'g'),'$1').replace(/(..)./g, '$1').replace(new RegExp('(\.[\d]{2}).','g'),'$1')" type="text" inputmode="decimal" lang="en" style="text-align: center; align-items: center; font-size:45px;" [(ngModel)]="credentials_transfe.monto">
0
0
300
Feb ’24