Home > Enterprise >  Cursor is going at the start automatically in contentEditable
Cursor is going at the start automatically in contentEditable

Time:05-14

I am creating a website builder. For Text edit, I m using contentEditable and to capture its state I m using the onInput event. but I don't know why every time I type something cursor goes to start.

CodeSandBox

CodePudding user response:

you CHANGE the state for each click and you display it. Cursor is reset when state is updated replace onInput with onBlur

  • Related