Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
jquery-maskmoney
Advanced tools
jQuery plugin to mask data entry in the input text in the form of money (currency)
Just a simple way to create masks to your currency form fields with jQuery.
To get the latest(minified) version, click here.
You can also use CloudFlare's cdnjs. Just choose the version you want to use here.
To view a complete demonstration of it's features and usage, access our examples page!
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" type="text/javascript"></script>
<script src="dist/jquery.maskMoney.min.js" type="text/javascript"></script>
</head>
<body>
<input type="text" id="currency" />
</body>
<script>
$(function() {
$('#currency').maskMoney();
})
</script>
The options that you can set are:
prefix
: the prefix to be displayed before(aha!) the value entered by the user(example: "US$ 1234.23"). default: ''suffix
: the prefix to be displayed after the value entered by the user(example: "1234.23 €"). default: ''affixesStay
: set if the prefix and suffix will stay in the field's value after the user exits the field. default: truethousands
: the thousands separator. default: ','decimal
: the decimal separator. default: '.'precision
: how many decimal places are allowed. default: 2allowZero
: use this setting to prevent users from inputing zero. default: falseallowNegative
: use this setting to prevent users from inputing negative values. default: falseIMPORTANT: if you try to bind maskMoney to a read only field, nothing will happen, since we ignore completely read only fields. So, if you have a read only field, try to bind maskMoney to it, it will not work. Even if you change the field removing the readonly property, you will need to re-bind maskMoney to make it work.
We have 3 bonus methods that can be useful to you:
.maskMoney('destroy')
removes maskMoney from an element..maskMoney('mask')
apply the mask to your input. This method can work as a setter as well, if you pass a value to it, like this .maskMoney('mask', 1999.99)
.maskMoney('unmasked')
return a float value (ex.: 'R$ 1.234,56' => 1234.56). PS: If you have only one input field, you should use this way .maskMoney('unmasked')[0]
, since it will always return an array.You can also configure maskMoney options using the data-* API instead of passing it as a hash in the .maskMoney
method call. To use it, simply set the options using data-<option>
, like this:
<input type="text" data-symbol="R$ " data-thousands="." data-decimal="," />
And when you bind maskMoney to that field, we will read those options.
jQuery-maskMoney is released under the MIT license.
FAQs
jQuery plugin to mask data entry in the input text in the form of money (currency)
We found that jquery-maskmoney demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.