title: Input text field filtering using jquery causes cursor to jump in IE and Chrome
body: <p>I am filtering input in input text fields, for example:</p>
  
  <p></p>
  
  <p>And I am filtering input on the fly, like removing non-numeric characters.</p>
  
  <pre><code>$("#txtlevel").bind('keyup', function(evt)
  {
      var value = $(this).val();
      value = value.replace(/\D/g, '');   /* Remove any non-digit characters */
      if ( value.length &gt; 1 )
      {
          value = value.replace(/^[ 0]/g,'');   /* Remove any leading spaces or zeros */
      }
      $(this).val(value);
  }
  </code></pre>
  
  <p>This works great in Firefox, but in IE and Chrome the cursor jumps to the end of the input field every time.  How can I prevent this or reset the cursor position?  I've seen code to do it for textfields but not input text fields.</p>