Skip to content

Instantly share code, notes, and snippets.

@cmd64
Last active August 19, 2021 12:53
Show Gist options
  • Save cmd64/41b957e25c0737a0d6c00c19cc18f25e to your computer and use it in GitHub Desktop.
Save cmd64/41b957e25c0737a0d6c00c19cc18f25e to your computer and use it in GitHub Desktop.
$(this).mask("#.##0,00", {
byPassKeys: [188, 189, 109],
reverse: true,
placeholder: "0,00",
translation: {
'#': {
pattern: /-|\d/,
recursive: true
}
},
onChange: function (value, e) {
e.target.value = value.replace(/(?!^)-/g, '').replace(/^,/, '').replace(/^-,/, '-');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment