将回车键转tab键

//功能:将回车键转tab键
$(function () {
$('input:text:first').focus();
var $enter = $("input[type=text],button[type='button'],select,textarea");
$enter .bind('keydown', function (e) {
var key = e.which;
if (key == 13) {
e.preventDefault();
var nextId = $enter.index(this) + 1;
$enter .eq(nextId).focus();
}
});

posted @ 2016-11-07 14:43  win.w  阅读(78)  评论(0编辑  收藏  举报