jquery: select next input even though in different fieldset
<p>I have the following html page:</p>

<pre><code>&lt;form action="editProfile" id="userInformation"&gt;
&lt;fieldset id="birthdate"&gt;
&lt;label&gt;&lt;input type="text" id="day" maxlength="2"/&gt;/&lt;input type="text" id="month" maxlength="2"/&gt;/&lt;input type="text" id="year" maxlength="2"/&gt;
&lt;/fieldset&gt;
&lt;fieldset&gt;
&lt;label&gt;Name&lt;/label&gt;&lt;input type="text" id="name"/&gt;
&lt;/fieldset&gt;
&lt;/div&gt;
</code></pre>

<p>Now I'd like to always jump to the next inputfield.
I've tried:</p>

<pre><code>$("#birthdate input[type=text]").keyup(function(e){
    if($(this).val().length == $(this).attr('maxlength')){
        $(this).next(":input").focus();
    }   
});
</code></pre>

<p>But that seems to stay within the fieldset. And nextall doesn't seem to work or I'm using it wrong.</p>

<p>edit:
My solution so far:</p>

<pre><code>        if($(this).val().length == $(this).attr('maxlength')){
            if($(this).parent().children().last().attr('id') == $(this).attr("id")){
                $(this).parent().next().find(':input').focus();
            }else{
                $(this).next("input").focus();
            }
        }
</code></pre>
