JQuery input.mask with regex
I want to implement a simple jquery mask flash using the jquery input.mask plugin , however I cannot get it to work with regex. I want to achieve:
99:59:59
Fiddle
+3
agriboz
source
to share
3 answers
You can do it like this.
$("#test").inputmask({
mask: "99:59:59",
definitions: {'5': {validator: "[0-5]"}}
});
A validator is an expression. The indication "5" in the mask line contains only numeric characters from 0 to 5.
edit: changed '-' to ':'
+7
Buster
source
to share
You mean something like this :
$('#test').inputmask('Regex', {
regex: "^[0-9]{2}:[0-5][0-9]:[0-5][0-9]$"
});
+2
Ferret
source
to share
use
<script src="../js/jquery.inputmask.bundle.js"></script>
<asp:TextBox class="form-control" ID="trvl_amt" data-inputmask="'mask': '9{0,50}.9{0,2}'" data-mask placeholder="Travel Amount" runat="server"></asp:TextBox>
Up to 50 numeric places + 2 Decimal
0
Arun Prasad ES
source
to share