Skip to content
Discussion options

You must be logged in to vote

@daheejo

Instead of format the number value by using "onInput", you should use "onBlur" to only format the value after end-user finished typing. Another solution is to use debounce to wait until typing is ended to trigger formatting. This is the easiest way to handle input with formatting and avoid to messing around with input selection (input caret |) and its value.

Example: https://input-number.vercel.app/demo/precision

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by bluebill1049
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants