PDA

View Full Version : Contenteditable Div Caret Position



Beanie
09-19-2010, 04:43 PM
I have a div tag that is contenteditable so that users can type in the div. There is a function that adds a link into the div when the user presses a button. I would like the caret to be positioned after the link so that users can continue to type. The link can be inserted many times.

Example Code:

<div id="mydiv" contenteditable="true" tabindex="-1">before <a href="#">link</a> after</div>

I require this code to work in: IE, Firefox, Opera, Safari and Chrome.

Can anyone offer any help?

Nile
09-19-2010, 05:36 PM
Can we please see all your code?

Beanie
09-19-2010, 09:39 PM
Can we please see all your code?

Does this help?
http://stackoverflow.com/questions/3611788/javascript-set-caret-in-contenteditable-div