If you must add a class called "TabOnEnter" to the fields in which you want to include a loop.
$(document).on("keypress", ".TabOnEnter" , function(e)
{
if( e.keyCode == 13 )
{
var nextElement = $('[tabindex="' + (this.tabIndex+1) + '"]');
console.log( this , nextElement );
if(nextElement.length )
nextElement.focus()
else
$('[tabindex="1"]').focus();
}
});
Not as cute as the previous answer, but now it works:
http://jsfiddle.net/konijn_gmail_com/WvHKA/
HTML (tabindex), . .