Percentage: Can't delete 0.00 %
I am using inputmask percentage to allow user to enter percentage value between 0.00 till 1000.00. However when user presses 0. and tabs out the input field gets populated to 0.00% which is what we require. We also require user to delete this 0.00 value however it seems delete key is not working or disabled by plugin.
Could you please tell how to allow user to delete this 0.00 value by using backspace or delete key. Please find source code
Could any one help in this regard and provide some pointers?
Any one can please point me towards some solution?
I'm working on a solution,but I only have little time to spend. Hopefully a fix soon
My workaround:
const currencyMask = createMask({
alias: 'numeric',
autoUnmask: true,
unmaskAsNumber: true,
radixPoint: ',',
groupSeparator: '.',
digits: 2,
digitsOptional: false,
showMaskOnHover: false,
onKeyDown:(event: KeyboardEvent) => {
if (event.key == 'Delete' || event.key == 'Backspace') {
let el = event.target as HTMLInputElement;
if (el.value == '0') el.value = '';
}
}
});