If in "onplete" callback make setVal action with other masked input, you can see incorrect reactions in Chrome and Safary, well work in FF
onplete: function(e){
$('.i-input-2').val($(e.currentTarget).inputmask('unmaskedvalue'));
}
Demo: /
If in "onplete" callback make setVal action with other masked input, you can see incorrect reactions in Chrome and Safary, well work in FF
onplete: function(e){
$('.i-input-2').val($(e.currentTarget).inputmask('unmaskedvalue'));
}
Demo: http://jsfiddle/serGlazkov/nxLzq82o/
Share Improve this question edited Sep 25, 2015 at 22:19 Joshua Dannemann 2,0802 gold badges16 silver badges35 bronze badges asked Sep 18, 2015 at 0:35 sglazkovsglazkov 1,0661 gold badge10 silver badges38 bronze badges2 Answers
Reset to default 7 +50It seems as though you have uncovered a critical bug with the jQuery inputmask plugin. There is some aggressive caret position handling when using autoGroup
and digitsOptional
options. When bined with multiple masked input instances it causes the caret to moved to index 0 after every keystroke.
Using the currency
mask with the following options will give you the most consistent interface.
$('.i-input-1').inputmask({
alias: 'currency',
rightAlign: false,
digits: 2,
onplete: function (e) {
var currVal = $(e.currentTarget).inputmask('unmaskedvalue');
copyValue1(currVal);
}
});
$('.i-input-2').inputmask({
alias: 'currency',
rightAlign: false,
digits: 2
});
function copyValue1(str){
$('.i-input-2').val(str);
}
<script src="https://ajax.googleapis./ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="https://dev.vanare/bundles/vanarewebsite/js/jquery.inputmask.bundle.min.js"></script>
<input type="text" class="i-input-1" value="100">
<input type="text" class="i-input-2" value="555" disabled="disabled">
Now this bug fixed in version 3.2.2