Question

I have been putting only jQuery mask so far, but I figured out that in Mozilla they have some problem. For example if I mask input with $(".someClass").mask("9?9"); and enter only one digit '1' Mozilla will submit value of "1_" which fails validation (is a number) but user definitely entered correct value.

Is there a mask like $(".someClass").mask("9?9"); that won't display underscore for maximum number of characters (in this case 2) so that user does not think that he must enter 2 characters???

Other problem is when you lose focus on masked field but you entered just few first required characters. When you return focus on the field it continues from the las character but erases all already entered.

I have tried also Telerik but it has so menu bugs and much more problems with underscore and cursor position.

Please if wrote if you have any suggestions and solutions.

Thanks a lot.

Was it helpful?

Solution

Can't reproduce your problem. Check demopage. If you enter only one number the value of the input is just that number. (What jquery version? What browser version?). Provide small sample which reproduces your problem.

http://jsbin.com/egeyo3

Your mask looks ok to me. If you don't want the user to think he needs to enter 2 numbers just replace the default placeholder _ with a space .

jQuery(function($) {
    $("#test").mask("9?9", {placeholder:" "});
});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top