Autotab input with javascript
<p>I have 3 inputs that need to tab to the next when the max length are reached.
These 3 inputs come with values and when the user change the value of the first input it focus on the next and so on.</p>

<p>My problem is that since my second input has already the length it jumps to the third input. If the use input the values slowly it don't do this.</p>

<p>The source of the problem is that if the typing is too fast the first keyup event is fired after the second type and it fires on the second input.</p>

<p>I've written a <a href="http://jsfiddle.net/pvXuS/4/" rel="nofollow">jsfiddle</a> with the problem and this is my function to wire the auto focus change.</p>

<pre><code> function WireAutoTab(CurrentElement, NextElement) {
    CurrentElement.keyup(function (e) {
        //Retrieve which key was pressed.
        var KeyID = (window.event) ? event.keyCode : e.keyCode;
        var FieldLength = CurrentElement.attr('maxlength');

        //If the user has filled the textbox to the given length and
        //the user just pressed a number or letter, then move the
        //cursor to the next element in the tab sequence.   
        if (CurrentElement.val().length &gt;= FieldLength &amp;&amp; ((KeyID &gt;= 48 &amp;&amp; KeyID &lt;= 90) || (KeyID &gt;= 96 &amp;&amp; KeyID &lt;= 105)))
            NextElement.focus();
    });
}
</code></pre>

<p>Is there any other event that I can use to prevent this? The behavior that I want is that even if the second input has value, it stops on it.</p>
