Fix caret position when lazyInit and mask is set to true.

Currently when lazyInit and mask is set to true, caret position will be set at the end. This makes it unable to type the date unless we move the cursor back to the start. 

I am not exactly sure if this is the correct place to do it but it works as expected.
This commit is contained in:
Saugat Acharya 2015-11-16 23:59:28 +05:45
parent 7e35e32536
commit 2626db5426

View File

@ -1156,6 +1156,7 @@
if ($.type(options.mask) === 'string') { if ($.type(options.mask) === 'string') {
if (!isValidValue(options.mask, input.val())) { if (!isValidValue(options.mask, input.val())) {
input.val(options.mask.replace(/[0-9]/g, '_')); input.val(options.mask.replace(/[0-9]/g, '_'));
setCaretPos(input[0], 0);
} }
input.on('keydown.xdsoft', function (event) { input.on('keydown.xdsoft', function (event) {