Willian Custódio
Willian Custódio

Reputation: 626

How auto format input number with currency mask (Ionic)

I need to create a currency mask (right to left) in a input=number of my mobile app (Ionic + Cordova). If the user enter with 123456 value, the input should be 1.234,56 (adding "," and "." automatically).

I don't know how to do this with HTML and Javascript.

Anybody help me?

Noting that input type should be "number", to show only numeric keyboard in device.

Sorry my poor english

Upvotes: 4

Views: 12921

Answers (3)

Crisboot
Crisboot

Reputation: 1480

I know your pain, I've seen a couple of solutions:

Upvotes: 1

Kiramishima
Kiramishima

Reputation: 192

look at this angular modules and directives:

http://aguirrel.github.io/ng-currency/

jsfiddle.net/odiseo/dj6mX/

http://assisrafael.github.io/angular-input-masks/

Upvotes: 3

Maxim Goncharuk
Maxim Goncharuk

Reputation: 1333

Look at this plugin for jQuery jquery-numberformatter:

$(this).parseNumber({format:"#,###.00", locale:"us"});

Upvotes: 1

Related Questions