If you click a label which is 'contenteditable', a cursor(caret) automatically place in the right place where the mouse was clicked. Same like this, I just want to place the cursor(caret) at the clicked place when user DOUBLE-CLICK the label area.
Let's say we have html like below.
<label id="label_1" contenteditable="false"
ondblclick="doubleClick(document.getElementById('label_1'))">
Hey, I just met you and this is crazy. But, here's my number and call
me maybe.
</label>
And the javascriptlike below.
<script>
function doubleClick(elem) {
elem.setAttribute("contenteditable", "true");
elem.focus();
}
</script>
At this code, there are 2 action for Double-Click.
First, when I double click the label, the cursor(caret) moves to the very front side. In this case, I want to place the cursor (caret) at the very right alphabet where the click event happend.
Second, when I double click the label, the cursor(caret) do hightlight the word. In this case, I want to place the cursor (caret) without hightligh.