Positioning cursor after inserted word
<p>I want to position a cursor after an inserted word (test), in textarea.<br>
The insertion of the word can be in any position in textarea.<br>
(Internet Explorer)<br>
This is my script:</p>

<pre><code> document.activeElement.focus();

 document.selection.createRange().text = "test";

 var sel = document.selection.createRange();
 sel.moveStart('character', -document.activeElement.value.length);
 var cursorPos = sel.text.length;

 var range = this.textarea.createTextRange();
 range.collapse(true);
 range.moveEnd('character', cursorPos);
 range.moveStart('character', cursorPos);
 range.select();
</code></pre>
