First of all, I'm using:
My goal:
The problem:
What should I do to solve this? Any tips are welcome.
You dont need to change your plugin. You could bind paste event and clear the content just before the paste. So the mask wont be keeping any spaces to prevent you from making your paste.
$('input.class').bind('paste', function () { $(this).val(''); });
Solution:
Change the placeholder from "_" or " " or any other placeholder to "" (empty string), as below:
$(".cpfInput").mask("99999999999",{placeholder:""});
The trick is that if you put any placeholder different of an empty string, the plugin will fill the input field with the placeholder and when you paste something it doesn't clean it before pasting whatever you're trying to paste.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With