How to fix cursor movement when editing and validating an input?
-
Hello!
Input.value is separated by a space every 3 characters.
How do I keep the cursor in place while editing?
Now goes to the end of the line
JavaScript Anonymous, May 4, 2019 -
When the change starts, keep the caret position
input.selectionStart
After replacing the value in the input - set the carriage positioninput.setSelectionRange(startPos,endPos) // Обе позиции должны быть одинаковыми, например (1,1)
Anonymous
1 Answers
Your Answer
To place the code, please use CodePen or similar tool. Thanks you!