Skip to content Skip to sidebar Skip to footer

Set The Caret Position Always To End In Contenteditable Div

In my project, I am trying to set the caret position always to the end of the text. I know this is default behaviour but when we add some text dynamically, then the caret position

Solution 1:

I got the solution here thanks to Tim down :). The problem was that I was calling

placeCaretAtEnd($('#result'));

Instead of

placeCaretAtEnd(($('#result').get(0));

as mentioned by jwarzech in the comments.

Working Fiddle


Post a Comment for "Set The Caret Position Always To End In Contenteditable Div"