1

How can I set the overridedefaultbutton to Tab so that pressing Enter tabs to the next input field, and doesn't cause a postback?

Azhar
  • 20,500
  • 38
  • 146
  • 211
Lill Lansey
  • 4,775
  • 13
  • 55
  • 77
  • 3
    sounds like your users want a website to act like the old mainframe screens - i kinda feel sorry for you - here is another question that might help http://stackoverflow.com/questions/3286174/capturing-onkeydown-in-javascript – Pete Amundson Aug 17 '10 at 20:25

1 Answers1

2

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

Community
  • 1
  • 1
Pete Amundson
  • 890
  • 5
  • 16