Click here to see a demo and example code
jquery.ghostFormat is a lightweight text field input foramatter plugin for jQuery. It allows for customizing input formats for numbers without changing the values that are saved to the database.
- jQuery (>= 1.7)
$('.example_input').ghostFormat();
The above code will intialize ghostFormat on the selected inputs with default options. The default format converts the inputted values to currency (dollars).
You can customize which format you want returned by passing in options as parameters.
$('.example_input').ghostFormat(options);
options
parameters are detailed below.
-
type
Specifies the format type returned by ghostFormat. The plugin currently accepts the following types passed in as a string:"money"
"phone"
"ssn"
default: "money" -
inputClass
Allows for passing in custom classes to the formatted text field input; Accepts string containing all classes:"form-control input-sm"
default: ""
Submit a GitHub Issue request.
This software is made available under the open source MIT License. © 2014 Abdul Miah and contributors