I have 3 inputs and on paste on first 2 i want to add value and focus on next input. Instead on paste it focus on next input and paste in it leaving first input empty
paste fires before the insert happens and it inserts into the focused element. so if you change the focus beforehand, you change the target location for the insert.
You might account for this by checking the element’s .selectionStart / .selectionEnd and split its .value accordingly… but another solution would be to schedule the .focus() to the next tick, so that the default action can take place as usual: