Insert text at cursor in a content editable div

Posted by nijikunai on Stack Overflow See other posts from Stack Overflow or by nijikunai
Published on 2010-05-27T10:09:46Z Indexed on 2010/05/27 10:11 UTC
Read the original article Hit count: 198

Filed under:

I have a contenteditable div where I need to insert text at the caret position,

This can be done in IE by document.selection.createRange().text = "banana"

Is there a similar way of implementing this in Firefox/Chrome?

(I know a solution exists here , but it looks sorta clumsy)

Thank you!

© Stack Overflow or respective owner

Related posts about contenteditable