Get caret position in textarea (IE)
<p>I want to get the caret position inside text area (Internet Explorer only).
I have this:  </p>

<pre><code>document.activeElement.focus();             
var sel2 = document.selection.createRange();
sel2.moveStart('character', -document.activeElement.value.length);
var caretPos = sel2.text.length;
alert(caretPos);
</code></pre>

<p>If textarea is one line only I get correct result, but if there are many lines the result is wrong because new line takes extra char that is not visible...</p>

<p>How can I get the correct position value (without removing \r\n and similar dirty work)? </p>
