开发者

How can I set the overridedefaultbutton to tab in asp.net?

开发者 https://www.devze.com 2023-01-11 19:28 出处:网络
How can I set the overridedefaultbutton to Tab so that pressing 开发者_高级运维Enter tabs to the next input field, and doesn\'t cause a postback? Try this jQuery:

How can I set the overridedefaultbutton to Tab so that pressing 开发者_高级运维Enter tabs to the next input field, and doesn't cause a postback?


Try this jQuery:

$('input').keydown(function(e){
    if (e.keyCode == 13){
      $(":input:eq(" + $(":input").index(this) + 1 + ")");
      return false;
    }
    return true;
});

It should add the onkeydown method to all elements of type input. Then if the e.keyCode is the enter key (13) then it will focus on the next element of type input.

sourced from: here and here

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号