inputTextArea losing focus in IE8
<p>I have a jsf 2.0 application in which I have an input text box and a number characters left counter at the bottom of input text box which I am updating through javascript.</p>

<pre><code>&lt;h:inputTextarea class="myInputTextClass"
value="#{bean.text}"
style="resize: none;width:445px;" type="text"
maxlength="255" cols="60" rows="3"
onfocus="countChars($('.myInputTextClass'),255)"
onkeyup="countChars($('.myInputTextClass'),255);"
onkeydown="countChars($('.myInputTextClass'),255);"
/&gt;

&lt;span id="char_count" style="font-style:italic;margin-left:-14px"&gt;255&lt;/span&gt;
</code></pre>

<p>Script:</p>

<pre><code>function countChars(element,  max) {

  calculateCount(element.val().length, max);
  if (element.val().length &gt; max) { 
    element.val(element.val().substring(0, max));
   }

  }

function calculateCount(length, max){
 var count = max - length;
    if(count &amp;lt; 0){
    count = 0;
    }
   document.getElementById('char_count').innerHTML =  count ;
}
</code></pre>

<p><strong>The problem is after typing in somewhere around 150 characters in the input text box, the focus shifts back to top of inputtextbox. However, the cursor remains at the end as expected.</strong> </p>

<p>I tried using the scrollTop position and focus but didn't work. Any suggestion is highly appreciated.</p>

<p>This issue happens only in IE8, in forefox it works fine.</p>
