- Added: Complete rewrite, with simplier and better code
- Added: Self initialize when the attribute "data-d-mask" is present, using its value
- Fixed: all input nodes was receiving the value of the first when the plugin was initiated
- Added: supporting for negative numbers using '-' prefix on the mask (issue #5);
- Fixed: inputting some invalid char in the middle of input content was causing the loss of all content on the right of the cursor (issue #3);
- Added: strict mode;
- Fixed: the first character inputed to field was throwing an error.
- Now using '.on' instead of deprecated '.live'.
- Fixed: An empty selector doesn't throw an JS error anymore. Issue #4.
- Now supported in early IE versions: 8, 7, 6 and 5.5.
- Small bug resolved (I didn't documented very well).
- Total rewritten, now based on regex replace.
This plugin just provides a decimal mask to an HTML input. It treats only the decimal separator, it can't handle thousand separators. It can apply the separator in the value given by the backend on web apps. The separator supported are the "," or ".". (I don't believe there are another types)
- Opera 10+ (Old versions not tested)
- Chrome 4+
- Firefox 2+
- IE 5.5+
- Safari 4+ (Old versions not tested)
The usage is simple:
$('your selector').decimalMask('your mask');
<input data-d-mask="999" />
Some valid masks are:
- You got it...