I have div with some text and contenteditable=”true”. When I single click on this div – works some my scripts, it is not very important. And when I double click on this div – need to edit text in div. Edit text need to be only after double click, not after single. And very imortant, when I double click on div – caret need stay under mouse cursor. No need selection text. I found some script for single/double. But have problem. When I double click on div – text are selection. Selection no need. Need editor caret where I clicked. I do not understand how.
http://jsfiddle.net/X6auM/
I have div with some text and contenteditable=true. When I single click on this
Share
Every current major browser provides an API to create a range from a mouse event, although there are four different code branches needed.
Here is some background:
Here’s a demo: http://jsfiddle.net/timdown/krtTD/10/
And here’s some code: