2012-11-19 100 views

回答

1

下面的代码应该很好地工作:

$("input").keypress(function(e) { 
    if (e.which == 13) { 
     var index = $("input[type='text']").index(this); 
     $("input[type='text']").eq(index + 1).focus(); 
     e.preventDefault(); 
    } 
});​ 

DEMO:http://jsfiddle.net/uJsMQ/

相关问题