While writing a text, a jQuery
script will try and replace from time to time some words.
The text is written within a div
tag with content editable set on true
.
How can I focus the cursor
at the end
of the last span child, right before the parent span ?
<div id="cl-edit-outline-title_AtD_div" contenteditable="true">
<span class="mceItemHidden">
<span class="hiddenSpellError" pre="">fgsddfsdfgdsfgsd</span>
<span class="hiddenSpellError" pre="a">a</span>
<span class="hiddenSpellError" pre="b">b</span>
<span class="hiddenSpellError" pre="c">c</span>
<span class="hiddenSpellError" pre="d">d</span>
</span>
</div>
I have searched on the web for solutions, but found none.