2013-01-23 39 views

回答

1
$('.serial').keypress(function(e) { 
    console.log(this); 
    if (e.which == 13) { 
     $(this).closest('tr').next().find('input.serial').focus(); 
     e.preventDefault(); 
    } 
}); 

http://jsfiddle.net/tYFcH/6/

+0

非常感謝它的偉大工程! – user2002232

4

假設你想要移動到擊中輸入任何輸入時,下面的單元格,使用這樣的:

$('table input').keypress(function(e) { 
    if (e.keyCode == 13) { 
     var $this = $(this), 
      index = $this.closest('td').index(); 

     $this.closest('tr').next().find('td').eq(index).find('input').focus(); 
     e.preventDefault(); 
    } 
}); 

這是你的提琴:http://jsfiddle.net/tYFcH/13/

相關問題