Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable to insert spaces in masked input plugin (JQuery Plugin)?

I use masked input plugin, but it forbid enter spaces. * - Represents an alphanumeric character (A-Z,a-z,0-9), but not allow space-symbol

like image 547
user3655719 Avatar asked Jun 19 '14 11:06

user3655719


1 Answers

In case if you use http://github.com/RobinHerbots/jquery.inputmask , you can create your own mask:

$.extend($.inputmask.defaults.definitions, {
    'A': { 
        validator: "[A-Za-z0-9 ]",
        cardinality: 1
    }
});
$("#field").inputmask("AAA");

If you use http://plugins.jquery.com/maskedinput/ , you create you mask like this:

$.mask.definitions['A'] = "[A-Za-z0-9 ]";
$("#field").mask("AAA");
like image 56
Iryna Avatar answered Sep 30 '22 19:09

Iryna