jQuery Currency Input Filed Mask Plugin - maskmoney

jQuery Currency Input Filed Mask Plugin - maskmoney
File Size: 22.6KB
Views Total:
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

maskmoney is a super simple jQuery plugin that make it easy to mask input filed text in the form of currency.

Features:

  • Lightweight and easy to use
  • Support for decimal and thousands separator
  • Support for customizable decimal places
  • Support for currency symbol 

Related Plugins:

How to use it:

1. Include jQuery library and jQuery maskmoney plugin on the web page

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" type="text/javascript"></script>
<script src="jquery.maskMoney.js" type="text/javascript"></script>

2. Create an input element for currency mask

<input type="text" id="demo1" />

3. Call the plugin with options

<script type="text/javascript">
$("#demo").maskMoney({
prefix:'US$ ', // The symbol to be displayed before the value entered by the user
allowZero:false, // Prevent users from inputing zero
allowNegative:true, // Prevent users from inputing negative values
defaultZero:false, // when the user enters the field, it sets a default mask using zero
thousands: '.', // The thousands separator
decimal: '.' , // The decimal separator
precision: 2, // How many decimal places are allowed
affixesStay : false, // set if the symbol will stay in the field after the user exits the field. 
symbolPosition : 'left' // use this setting to position the symbol at the left or right side of the value. default 'left'
}); //
</script>

Change log:

v3.0.2 (2014-01-18)

  • update to latest version.

v3.0.0 (2013-12-31)

  • bugs fixed.

v2.9.6 (2013-12-29)

  • bugs fixed.

v2.9.0 (2013-12-28)

  • symbol` ~> `prefix`
  • `symbolStay` ~> `affixesStay`
  • `symbolPosition` no longer exists and to put the symbol at the right, you should use `suffix`
  • `affixesStay` is now default to `true`

v2.7.0 (2013-12-26)

  • adding the option to configure maskMoney parameters as data-* in the input itself.

v2.5.0 (2013-12-17)

  • bugs fixed.

This awesome jQuery plugin is developed by plentz. For more Advanced Usages, please check the demo page or visit the official website.