Could you explain me the logic of the setSelection methods for my case?
E.g. I have a pattern (111) 111-1111. I want to edit number starting from the fourth digit.
So, I call setSelection({start: 6, end: 6}), but... Oh! That sets selection to {start: 4, end: 4}! Ok, I think, it's okay if it works correctly. But.. when I try to paste some digits it just skips first of them and only after this skipping selection becomes {start: 6, end: 6}. Of course, other numbers paste normally after that.
So, tell me pls what's the logic of this work and if there are mistakes how should it work?
Hi guys.
Could you explain me the logic of the setSelection methods for my case?
E.g. I have a pattern
(111) 111-1111
. I want to edit number starting from the fourth digit.So, I call
setSelection({start: 6, end: 6})
, but... Oh! That sets selection to{start: 4, end: 4}
! Ok, I think, it's okay if it works correctly. But.. when I try to paste some digits it just skips first of them and only after this skipping selection becomes{start: 6, end: 6}
. Of course, other numbers paste normally after that.So, tell me pls what's the logic of this work and if there are mistakes how should it work?