I’m trying to set up a controlled contentEditable in React. Every time i write something in the div the component re-renders, and the cursor/caret jumps back to the beginning. I’m trying to deal with this by saving the cursor in an onInput callback: This doesn’t work, the cursor is still stuck at the beginning. If I input one character in
Tag: caret
Could you make it blink? [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 2 years ago. Improve this question I found this code but I could not figure out how to make the cursor blink Answer I found a simple way to do it
JavaScript get word before cursor
Okay, I’ve been looking all over the web to find a solution but I couldn’t find one, is there a way to get the word before the caret position in an editable div so a bit like: This should return the word “some”… I don’t know if this is possible, I would be glad for any help, thanks :). Answer
Get contentEditable caret position
I’m finding tons of good, cross-browser answers on how to set the caret position in a contentEditable element, but none on how to get the caret position in the first place. What I want to do is know the caret position within a div on keyup. So, when the user is typing text, I can, at any point, know the