Jquery Focus on input field
<p>I have this code working on a page that literally just has 20 input fields each named and id'ed 1 through 20.</p>

<p>If I set the variable id to the next id. E.g current fields id +1 then it will focus on that field. But at the moment when you click out of the current input it will not focus back onto the one you were last typing in if the number entered is over 10, but the alert will fire.</p>

<p>Any help is appreciated.</p>

<pre><code>$(":input").focusout(function(){
    var input = $(this).val();
    var id    = $(this).attr('id');
    if(input &gt; 10){ 
        alert('You must enter a number between 0 and 10 '+id);
        $("#"+id).select();
    }
});
</code></pre>
