nosir / cleave.js

Format input text content when you are typing...
http://nosir.github.io/cleave.js
Apache License 2.0
17.95k stars 1.62k forks source link

AlphaNumeric Option please #427

Open faststare08 opened 5 years ago

faststare08 commented 5 years ago

To reproduce the error or describe your requirement with a jsfiddle url would be appreciated:

If it's mobile related, please specify your device and environment.

kaYcee commented 5 years ago

I second this. Great library, but eventually I had to find alternatives due to its missing alpha-numeric filter option. Our use case can allow only a subset of letters (no capital O or I since they can easily be confused).

keennang commented 5 years ago

Having this option would be really helpful.

mikesaintsg commented 5 years ago

Here is a quick fix that i put in my script, it's reactive to the input, so not as clean as when you use numericOnly, but it does the trick.

        $('#id').on('keyup', function () {
            var input = $(this).val();
            var regex = input.replace(/[^\w]/g, "");
            $(this).val(regex);
        })