igorescobar / jQuery-Mask-Plugin

A jQuery Plugin to make masks on form fields and HTML elements.
http://igorescobar.github.io/jQuery-Mask-Plugin/
Other
4.77k stars 1.42k forks source link

Value trims on pasting iban number into input field. #710

Open Faizan-Shakeel opened 5 years ago

Faizan-Shakeel commented 5 years ago

Pattern I need in an input field: ("SS00 0000 0000 0000 0000 00"); Example: DE00 0000 0000 0000 0000 00

Copy pasted values are trimmed if longer than the above pattern because of having more than one space in between. Example value to reproduce the unwanted behavior: DE00 0000 0000 0000 0000 00

Any possible solution please?

igorescobar commented 5 years ago

You can use this: http://igorescobar.github.io/jQuery-Mask-Plugin/docs.html#mask-as-a-function

And remove spaces from the string before applying the mask. It would solve your issue.

Faizan-Shakeel commented 5 years ago

thanks a lot, I will try that.