contentEditable javascript caret placement in div
Posted
by Ben Mc
on Stack Overflow
See other posts from Stack Overflow
or by Ben Mc
Published on 2009-12-12T09:26:36Z
Indexed on
2010/03/23
6:33 UTC
Read the original article
Hit count: 593
I have a contentEditable
div.
Let's say the user clicks a button that inserts HTML into the editable area.
So, they click a button and the following is added to the innerHTML
of the contentEditable
div:
<div id="outside"><div id="inside"></div></div>
How do I automatically place the cursor (ie caret) IN the "inside" div? Worse. How can this work in IE and FF?
© Stack Overflow or respective owner