JavaScript setSelectionRange() method and cursor position
<p>I have the following piece of JavaScript for dynamically inserting unicode characters - represented below by the txtToIns variable - into a body of text</p>

<pre><code>elmt.value = elmt.value.substring(0, elmt.selectionStart) + txtToIns + " " + elmt.value.substring(elmt.selectionStart, elmt.selectionEnd) + elmt.value.substring(elmt.selectionEnd, elmt.value.length) + " ";
elmt.focus();
elmt.value = elmt.value.trim();
</code></pre>

<p>With the above the cursor is always at the end of the text. Is there any way I can place it directly after txtToIns? And no, txtToIns.focus() won't work</p>
