Heet Vakharia
Heet Vakharia

Reputation: 445

Cursor is going at the start automatically in contentEditable

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

Upvotes: 1

Views: 339

Answers (1)

Юрий Копоть
Юрий Копоть

Reputation: 384

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

Upvotes: 1

Related Questions