Expand text field when text gets close to the end
<p>I want to make the textfield expand when the text nearly gets to the end, it works but when i type the first letter in it shrinks and then it expands </p>

<p>i.e <a href="http://jsfiddle.net/Y3rMM/" rel="nofollow">http://jsfiddle.net/Y3rMM/</a></p>

<p>How can i keep the textfield the same size until it reaches the end and expands</p>

<p>i.e so when i type my first letter it does not shrink but it stays the same size </p>

<pre><code>//HTML
&lt;input type="text"/&gt;


//JQUERY
$(document).ready(function(){
                $("input").keyup(function(){
                    contents = $(this).val();
                    charlength = contents.length;
                    newwidth = 10 + (charlength*10);
                    $(this).css({width:newwidth});
                });        
            });
</code></pre>
