Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jquery input.mask with regex

I want to implement simple jquery mask pluging using jquery input.mask plugin, however, i cannot make it work with regex. What i want to achieve is:

99:59:59

Fiddle

like image 603
agriboz Avatar asked Dec 19 '22 08:12

agriboz


1 Answers

You can do it like this.

$("#test").inputmask({
            mask: "99:59:59",
            definitions: {'5': {validator: "[0-5]"}}
    });

The validator is an expression. Telling the "5" in the mask string to contain only numerical characters from 0 to 5.

edit: changed '-' to ':'

like image 133
Buster Avatar answered Dec 28 '22 06:12

Buster