//按鍵監(jiān)聽(tīng)事件
$(document).on('keydown', '.layui-input',
function(event) {
var td = $(this).parent('td');
var index = td.index();
var tr = td.parent('tr');
var key = event.keyCode;
switch (key) {
case 38://上鍵ArrowUp
tr['prev']().children('td').eq(index).click();
setTimeout(function(){
$('.layui-table-edit').select(),0
});
break;
case 40://下鍵ArrowDown
tr['next']().children('td').eq(index).click();
setTimeout(function(){
$('.layui-table-edit').select(),0
});
break;
case 9://TAB
tr['next']().children('td').eq(index).click();
setTimeout(function(){
$('.layui-table-edit').select(),0
});
break;
case 13://回車
tr['next']().children('td').eq(index).click();
setTimeout(function(){
$('.layui-table-edit').select(),0
});
break;
case 37://左鍵ArrowLeft
td['prevAll']('[data-edit="text"]:first').click();
break;
case 39://右鍵ArrowRight
td['nextAll']('[data-edit="text"]:first').click();
break;
}
});