Skip to content

Commit

Permalink
Fix plugin behavior to show default placeholder when allowEmpty is …
Browse files Browse the repository at this point in the history
…`true` fixes #20 fixes #21
  • Loading branch information
kartik-v committed May 23, 2017
1 parent ed962db commit e783ca6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Change Log: `yii2-money`
- fixes masking when precision is set but the decimal part length is less than precision length (for example 1400.50 with precision 2 was wrongly displayed as 140.05 - this change fixes this bug where the leading zeros after decimals were omitted)
- (enh #25, #11, #10): Update to release v3.1.1 of source plugin.
- (bug #24, #17, #12, #4): Enhance to calculate changed money mask when enter key is pressed.
- (enh #21, #20): Fix plugin behavior to show default placeholder when `allowEmpty` is `true`.
- (enh #15): New `displayInputName` property to control display input name attribute.
- Add composer alias for latest dev master release.
- Add github contribution and issue/PR logging templates.
Expand Down
4 changes: 3 additions & 1 deletion assets/js/jquery.maskMoney.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,9 @@

function mask() {
var value = $input.val();
if (settings.allowEmpty && value === "") {
// corrected by Kartik for initial empty value being treated as NaN
if (settings.allowEmpty && (value === "" || isNaN(parseFloat(value)))) {
$input.val("");
return;
}
if (settings.precision > 0 && value.indexOf(settings.decimal) < 0) {
Expand Down
2 changes: 1 addition & 1 deletion assets/js/jquery.maskMoney.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e783ca6

Please sign in to comment.