How can I modify this to search for tabindex?

How can I modify this to search for tabindex?

The function below will automatically move to the next input field in the event that a user hits the enter key. I'm trying to modify it so that it moves to the next input field with a tabindex set. So, in the example below, it'll move to the next input field chronologically, instead of how they're ordered on the page itself:

<input type="text" name="a" tabindex="1" />

<input type="text" name="b" tabindex="3" />

<input type="text" name="c" tabindex="2" />

Any idea if that's possible?

$('input').live("keypress", function(e) {
        /* ENTER PRESSED*/
        if (e.keyCode == 13) {
                /* FOCUS ELEMENT */
                var inputs = $(this).parents("form").eq(0).find(":input");
                var idx = inputs.index(this);

                if (idx == inputs.length - 1) {
                        inputs[0].select()
                } else {
                        inputs[idx + 1].focus(); //  handles submit buttons
                        inputs[idx + 1].select();
                }
                return false;
        }
});