Monday, 19 August 2013

jquery inputmask hiding numbers when skipping optional mask (second one)

jquery inputmask hiding numbers when skipping optional mask (second one)

I have a simple mask for phone number with optional numbers(due to
different formats for various cities) . I have applied mask 9[9][9] 999[9]
9999. Where [9] is optional.
<script src="~/Scripts/jquery-1.8.2.js"></script>
<script src="~/Scripts/jquery-ui-1.8.24.js"></script>
<script src="~/Scripts/jquery.inputmask.js"></script>
<input id="Phone1"/>
<script type="text/javascript" >
$(function() {
$("#Phone1").inputmask("9[9][9] 999[9] 9999");
});
</script>
This works fine for the numbers: 1 123 1234, 12 123 1234 etc.
but when I enter 123 123{space bar} the input field value become 12___ and
last 4 digits digits I entered disappear. Is this a bug or am I not using
correctly? This happens only when I have two groups of optional numbers
and I enter all the numbers in the first group and press spacebar for the
second optional number. Please help.

No comments:

Post a Comment