jQuery plugin to mask data entry in the input text in the form of money (currency).
Pull request Compare This branch is 182 commits behind plentz:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
README.md
index.html
jquery.maskMoney.js

README.md

Just a simple way to create masks to your currency form fields with jQuery.


Show Time!

To view a complete demonstration of it's features and usage, access our examples page!


Usage:

    <head>
        <script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js" type="text/javascript"></script>
        <script src="//raw.github.com/plentz/jquery-maskmoney/master/jquery.maskMoney.js" type="text/javascript"></script>
    </head>
    <body>
        <input type="text" id="currency" />
    </body>
    <script>
    $(function(){
        $("#currency").maskMoney();
    })
    </script>

Options:

The options that you can set are:

  • symbol: the symbol to be used before of the user values. default: 'US$'
  • showSymbol: set if the symbol must be displayed or not. default: false
  • symbolStay: set if the symbol will stay in the field after the user exists the field. default: false
  • thousands: the thousands separator. default: ','
  • decimal: the decimal separator. default: '.'
  • precision: how many decimal places are allowed. default: 2
  • defaultZero: when the user enters the field, it sets a default mask using zero. default: true
  • allowZero: use this setting to prevent users from inputing zero. default: false
  • allowNegative: use this setting to prevent users from inputing negative values. default: false

Bonus!

We have 2 bonus methods that can be useful to you:

  • .unmaskMoney() which removes maskMoney from an element.
  • .mask() which causes maskMoney to actually apply the mask to your input.

Contributors:


License:

jQuery-maskMoney is released under the MIT license.