Focus on next input when maxlength is reached

HTML

a: <input type="text" maxlength="5" />
<div>
hello
</div>
b: <input type="text" maxlength="3" />
c: <input type="text" maxlength="5" />
d: <input type="text" maxlength="3" />
e: <input type="text" maxlength="6" />
f: <input type="text" maxlength="10" />
g: <input type="text" maxlength="7" />

JavaScript

$(document).ready(function(){
    $('input').keyup(function(){
        if($(this).val().length==$(this).attr("maxlength")){
              $(this).parent().nextAll().children(":not(.readonly):input").eq(0).focus();
        }
    });
});