What is the easiest way to format a currency in HTML/CSS/Javascript


I want to auto format a number that is being entered into an input box as currency. For example, if I enter 1023, then I want it to be formatted as 10.23, so the user has the option to enter the decimal. I would like this to happen while the user is in the input, so they do not have to leave the box for the change to occur. I have looked over SO and I know it has to be there, but I must not be using the right query to find it. Please point me in the right direction.

Problem courtesy of: jhamm


I have used in autonumeric but there are lots of mask plugins, another I have used is this jquery currency plugin

Solution courtesy of: Gabe


you can use jquery plugin (masking) : http://igorescobar.github.io/jQuery-Mask-Plugin/

Discussion courtesy of: Rakesh Singh

I use a js library in order to achive.

Take a look at it.


Discussion courtesy of: bruno.bologna

This recipe can be found in it's original form on Stack Over Flow.