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
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
Share Improve this question asked Dec 23, 2014 at 8:35 agribozagriboz 4,8544 gold badges36 silver badges49 bronze badges3 Answers
Reset to default 9You 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 ':'
You mean something like this:
$('#test').inputmask('Regex', {
regex: "^[0-9]{2}:[0-5][0-9]:[0-5][0-9]$"
});
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