Simulate pressing tab key with jQuery

后端 未结 4 1102
不思量自难忘°
不思量自难忘° 2020-12-09 15:14

I have some textboxes on a .net-page and want to achieve the following with jQuery: if the user presses return, the program should behave \"as if\" he had used the tab key,

4条回答
  •  [愿得一人]
    2020-12-09 16:05

    Try this:

    http://jsbin.com/ofexat

    $('.tg').bind('keypress', function(event) {
      if(event.which === 13) {
        $(this).next().focus();
      }
    });
    

    or the loop version: http://jsbin.com/ofexat/2

提交回复
热议问题