2016-07-20 37 views

回答

1

停止形式進入

$('form').keydown(function (e) { 
    if (e.which === 13) { 
     e.preventDefault(); 
    } 
}); 

$('.inputs').keydown(function (e) { 
    if (e.which === 13) { 
     var index = $('.inputs').index(this) + 1; 
     $('.inputs').eq(index).focus(); 
    } 
}); 
0
$("input").bind("keydown", function(event) { 

if (event.which === 13) { 
    $(this).next("input").focus(); 
} 
}); 
+0

爲什麼不到風度的工作給我嗎? – Motion

+0

請查看https://jsfiddle.net/pmajhwar/zgu9rLxs/ –

+0

雖然此代碼可能會回答問題,但提供有關* how *和/或* why *解決問題的其他上下文會提高答案的長期價值。 –

相關問題