mirror of
https://github.com/xdan/datetimepicker.git
synced 2024-11-18 06:24:22 +00:00
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:
parent
7e35e32536
commit
2626db5426
@ -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) {
|
||||||
|
Loading…
Reference in New Issue
Block a user