Skip to content Skip to sidebar Skip to footer

Get Caret Html Position In Contenteditable Div

I am having troubles figuring out how to get caret position in a DIV container that contains HTML tags. I am using this JavaScript function to do that: function getCaretPosition()

Solution 1:

I created a simple fiddle for you that does what you want.

This should work in recent versions of Firefox, Chrome and Safari.

It's your homework to add Opera and IE support if you need.

Post a Comment for "Get Caret Html Position In Contenteditable Div"